addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1launch-new-window--smalllight-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [PhillyPUG] Interesting issue writing to syslog

From: Timothy M.
Sent on: Tuesday, September 10, 2013 1:56 PM
Thanks for the information, gents.

We tried it on Solaris + RHEL6, and it works like a gem on both. I owe you each a beer at one of the get togethers!

Regards,

-Tim


On Tue, Sep 10, 2013 at 1:54 PM, Jason Stelzer <[address removed]> wrote:
Your mac has a newer version of python/syslog. Things changed a decent amount between 2.6 and 2.7, so it's apples/oranges.

You might not even need to call openlog() since syslog.syslog("MESSAGE") will open the log if it's not already open and write the message to the default log file. I verified this on 2.7 and 2.4.


I use syslog-ng for logging. One of the nice things about it is that it plays nicely with concurrent loggers and by using tags and syslog levels it is easy to create log files that have different names/purposes and rotate on different schedules.

Finally, I don't use the syslog module at all. The syslog udp protocol is dirt simple, just drop messages on the wire and with the right levels/tags and you're golden.



On Tue, Sep 10, 2013 at 11:40 AM, Timothy Michael <[address removed]> wrote:
Has anyone run into issues writing to syslog? According to the 2.6.6 documentation:


We don't really care about Solaris, but just as an academic exercise, we ran it there as well. Please see below: this runs fine on Mac, but not on RHEL6 or Solaris. Any ideas?

SOLARIS:

[myuser@mysystem3 ~]$ python
Python 2.6.2 (r262:71600, Sep  9 2009, 06:31:01) [GCC 3.4.6] on sunos5 Type "help", "copyright", "credits" or "license" for more information.
 >>> import syslog
 >>> syslog.openlog()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: ident string [, logoption [, facility]]  >>> syslog.openlog(facility = syslog.LOG_LOCAL6) Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: openlog() takes no keyword arguments

RHEL6:

[myuser@mysystem-sas3-dev-h ~]$ python
Python 2.6.6 (r266:84292, May[masked], 05:35:12) [GCC[masked] (Red Hat 4.4.7-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
 >>> import syslog
 >>> syslog.openlog()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: ident string [, logoption [, facility]]  >>> syslog.openlog(facility = syslog.LOG_LOCAL6) Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: openlog() takes no keyword arguments

MAC OS/X:

[myuser@aeonflux ~]$ python
Python 2.7.2 (default, Oct[masked], 20:14:37) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or "license" for more information.
 >>> import syslog
 >>> syslog.openlog()
 >>> syslog.openlog(facility = syslog.LOG_LOCAL6)

Any help would be much appreciated. Hopefully it isn't a rookie mistake.

Regards,

-Tim




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Timothy Michael ([address removed]) from The Philadelphia Python Users Group (PhillyPUG).
To learn more about Timothy Michael, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]



--
J.





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jason Stelzer ([address removed]) from The Philadelphia Python Users Group (PhillyPUG).
To learn more about Jason Stelzer, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy