Re: How to get the current set LOG_MASK in Python's syslog module?

2022-09-22 Thread Chris Angelico
On Thu, 22 Sept 2022 at 23:46, Richard Moseley wrote: > > According to documentation syslog.setlogmask returns the current mask so > save the value to reset later on. > > Oldval = syslog.setlogmask(newmask) > > This sets oldval to original mask. This on its own suggests an odd technique that shou

Re: How to get the current set LOG_MASK in Python's syslog module?

2022-09-22 Thread Dennis Lee Bieber
On Thu, 22 Sep 2022 13:28:57 +, c.bu...@posteo.jp declaimed the following: >I would like to get the current `LOG_MASK`, which is kind of a logging >level. According to the docu it seems that `syslog` doesn't have a >mechanism for that. > There is a function .

Re: How to get the current set LOG_MASK in Python's syslog module?

2022-09-22 Thread Richard Moseley
> I'm aware that there is a `logging` package that is more _modern_ then > [`syslog`](https://docs.python.org/3/library/syslog.html). But I have > old code here to deal with that does use `syslog`. So that question is > specific to `syslog` and not to `logging`. > > I woul

How to get the current set LOG_MASK in Python's syslog module?

2022-09-22 Thread c . buhtz
X-Post: https://stackoverflow.com/q/73814924/4865723 Hello, I'm aware that there is a `logging` package that is more _modern_ then [`syslog`](https://docs.python.org/3/library/syslog.html). But I have old code here to deal with that does use `syslog`. So that question is specific to `s

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Barry
> On 6 Mar 2022, at 19:38, Peter J. Holzer wrote: > > On 2022-03-06 18:28:59 +0100, Peter J. Holzer wrote: >>> On 2022-03-05 16:25:38 +, Barry Scott wrote: >>> Using the syslog() function means that any platform/distro details are >>> hidden from the us

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Peter J. Holzer
On 2022-03-06 18:28:59 +0100, Peter J. Holzer wrote: > On 2022-03-05 16:25:38 +, Barry Scott wrote: > > Using the syslog() function means that any platform/distro details are > > hidden from the user of syslog() and as is the case of macOS it > > "just works". &g

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Peter J. Holzer
remaining 1 % is my contrarian alter ego arguing that > > that's really the distribution maintainer's job since a Linux > > distribution might use some other socket). > > > > If you are saying it should use the libc syslog routines, I disagree for > > at

Re: Getting Syslog working on OSX Monterey

2022-03-05 Thread Barry Scott
> On 4 Mar 2022, at 21:23, Peter J. Holzer wrote: > > On 2022-02-28 22:05:05 +, Barry Scott wrote: >> On 28 Feb 2022, at 21:41, Peter J. Holzer wrote: >>> On 2022-02-27 22:16:54 +, Barry wrote: >>>> I have always assumed that if I want a logger sy

Re: Getting Syslog working on OSX Monterey

2022-03-04 Thread Peter J. Holzer
On 2022-02-28 22:05:05 +, Barry Scott wrote: > On 28 Feb 2022, at 21:41, Peter J. Holzer wrote: > > On 2022-02-27 22:16:54 +, Barry wrote: > >> I have always assumed that if I want a logger syslog handler that I would > >> have > >> to implement it

Re: Getting Syslog working on OSX Monterey

2022-03-03 Thread Philip Bloom via Python-list
Grabbing latest python that does work. Good we're about to get out of the stone ages a bit here. So findings: Syslog - works in 3.10, broken against monterey in 3.6. Logging.Handlers.Sysloghandler - is broken in both against Monterey. Will bug it for the tracker. Thanks for the fee

Re: Getting Syslog working on OSX Monterey

2022-03-03 Thread Barry Scott
fine on OSX Big Sur, but on OSX Monterey > it doesn't work at all. Users that haven't updated are having the program > produce logs as it has for years through logging.handlers.SysLogHandler. Mac > OSX definitely has a listening socket at '/var/run/syslog' which shows

Re: Getting Syslog working on OSX Monterey

2022-03-02 Thread Philip Bloom via Python-list
n't updated are having the program produce logs as it has for years through logging.handlers.SysLogHandler. Mac OSX definitely has a listening socket at '/var/run/syslog' which shows up in Console.app. Apologies, Barry. I'm not quite understanding your responses. When we say OSX

Re: Getting Syslog working on OSX Monterey

2022-02-28 Thread Barry Scott
> On 28 Feb 2022, at 21:41, Peter J. Holzer wrote: > > On 2022-02-27 22:16:54 +, Barry wrote: >> If you look at the code of the logging modules syslog handle you will see >> that >> it does not use syslog. It’s assuming that it can network to a syslog >>

Re: Getting Syslog working on OSX Monterey

2022-02-28 Thread Peter J. Holzer
On 2022-02-27 22:16:54 +, Barry wrote: > If you look at the code of the logging modules syslog handle you will see that > it does not use syslog. It’s assuming that it can network to a syslog > listener. > Such a listener is not running on my systems as far as I know. >

Re: Getting Syslog working on OSX Monterey

2022-02-27 Thread Barry
; follow previously and I may be missing something fundamental. I've looked > over a number of online examples but they don't seem to be running > correctly either. I'm on Python 3.6.8 (though we're about to start an > upgrade to the latest stable, if that in theory may h

Re: Getting Syslog working on OSX Monterey

2022-02-27 Thread Dennis Lee Bieber
On Sun, 27 Feb 2022 14:17:39 -0500, Dennis Lee Bieber declaimed the following: APOLOGIES -- I thought I KILLED the draft message, not sent it... -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.o

Re: Getting Syslog working on OSX Monterey

2022-02-27 Thread Philip Bloom via Python-list
Thanks. Had tried it with no address, which defaults to ('localhost', '514') as well as address='/var/run/syslog' which had been working previously, and the doc recommends as: For example, on Linux it’s usually ‘/dev/log’ but on OS/X it’s ‘/var/run/syslog’. You’ll n

Re: Getting Syslog working on OSX Monterey

2022-02-27 Thread Dennis Lee Bieber
On Sun, 27 Feb 2022 08:34:21 -0800, Philip Bloom declaimed the following: > >sys_handler = SysLogHandler(address='/var/run/syslog') As I read the documentation, the address is supposed to be the NETWORK address of the machine to receive the log messages... https://d

Getting Syslog working on OSX Monterey

2022-02-27 Thread Philip Bloom via Python-list
m to be running correctly either. I'm on Python 3.6.8 (though we're about to start an upgrade to the latest stable, if that in theory may have changes to syslog handling). I'm mostly ending up here since I'm finding such differences in response between python modules I'd expect

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-16 Thread Thomas Güttler
#x27;:( > >> logging.StreamHandler(), > >> logging.Formatter('VPN - %(levelname)s - %(message)s'), > >> logging.ERROR, > >> ), > >> } > > > > > > Yes, I could do it this way. > > > > But someho

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-15 Thread dieter
ogging.ERROR, >> ), >> } > > > Yes, I could do it this way. > > But somehow I am not happy with this solution. > > I think the filtering should be outside of python. Do you think, it will be easier there? You could also use the "syslog" han

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-15 Thread jmp
On 09/15/2015 11:35 AM, Thomas Güttler wrote: Yes, I could do it this way. But somehow I am not happy with this solution. I think the filtering should be outside of python. [snip] Can you understand my concerns? Thomas Güttler No, not really. I showed you how it can be done in p

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-15 Thread Thomas Güttler
Am Freitag, 11. September 2015 10:18:11 UTC+2 schrieb marco@colosso.nl: > On Friday, September 11, 2015 at 9:22:42 AM UTC+2, Thomas Güttler wrote: > > Am Donnerstag, 10. September 2015 08:42:47 UTC+2 schrieb dieter: > > > Thomas Güttler writes: > > > > ... > > > > Why we are unhappy with loggin

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-15 Thread Thomas Güttler
Am Freitag, 11. September 2015 11:03:52 UTC+2 schrieb jmp: > On 09/11/2015 09:22 AM, Thomas Güttler wrote: > > > > I want INFO to be logged and stored on the remote host. > > Therefore I must not filter INFO messages. > > > > I don't want to pull INFO messages over the VPN. > > > > Ergo, the filter

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-11 Thread dieter
Thomas Güttler writes: > Am Donnerstag, 10. September 2015 08:42:47 UTC+2 schrieb dieter: >> Thomas Güttler writes: >> > ... >> > Why we are unhappy with logging to files: >> > >> > - filtering: We don't want to get INFO messages over the VPN. >> >> You can quite easily control at what level me

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-11 Thread jmp
On 09/11/2015 09:22 AM, Thomas Güttler wrote: I want INFO to be logged and stored on the remote host. Therefore I must not filter INFO messages. I don't want to pull INFO messages over the VPN. Ergo, the filtering at Python level does not help in my use case. Or I am missing something. Proba

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-11 Thread marco . nawijn
On Friday, September 11, 2015 at 9:22:42 AM UTC+2, Thomas Güttler wrote: > Am Donnerstag, 10. September 2015 08:42:47 UTC+2 schrieb dieter: > > Thomas Güttler writes: > > > ... > > > Why we are unhappy with logging to files: > > > > > > - filtering: We don't want to get INFO messages over the VPN.

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-11 Thread Thomas Güttler
Am Donnerstag, 10. September 2015 08:42:47 UTC+2 schrieb dieter: > Thomas Güttler writes: > > ... > > Why we are unhappy with logging to files: > > > > - filtering: We don't want to get INFO messages over the VPN. > > You can quite easily control at what level messages are logged with > the stand

Re: From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-09 Thread dieter
Thomas Güttler writes: > ... > Why we are unhappy with logging to files: > > - filtering: We don't want to get INFO messages over the VPN. You can quite easily control at what level messages are logged with the standard Python logging framework. Each handler has a level and will ignore messages

From logging to files to a better solution: syslog, Sentry, Logstash, ....

2015-09-09 Thread Thomas Güttler
Up to now we use simple logging to files. We don't use syslog or an other server based solution. I am unsure which architecture works for our environment. Our environment: - django based applications - a lot of batch/cron jobs (non web gui) processing - One linux server runs several sy

Re: redirect stderr to syslog?

2014-08-18 Thread Grant Edwards
On 2014-08-16, Terry Reedy wrote: > On 8/15/2014 11:04 PM, Russell E. Owen wrote: >> We are using the syslog module for logging, and would like to redirect >> stderr to our log. Is there a practical way to do it? > > You can replace sys.stderr with any object with a .wri

Re: redirect stderr to syslog?

2014-08-16 Thread Roy Smith
In article <53eee06a$0$29984$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Russell E. Owen wrote: > > > I realize the logging module supports this and has a syslog writer, so > > that's a fallback. But we were hoping to use the syslog module

Re: redirect stderr to syslog?

2014-08-16 Thread Terry Reedy
On 8/15/2014 11:04 PM, Russell E. Owen wrote: We are using the syslog module for logging, and would like to redirect stderr to our log. Is there a practical way to do it? You can replace sys.stderr with any object with a .write(s) method. -- Terry Jan Reedy -- https://mail.python.org

Re: redirect stderr to syslog?

2014-08-15 Thread Steven D'Aprano
Russell E. Owen wrote: > I realize the logging module supports this and has a syslog writer, so > that's a fallback. But we were hoping to use the syslog module for > performance. Have you benchmarked your code and discovered that using the logging module makes a noticeable

redirect stderr to syslog?

2014-08-15 Thread Russell E. Owen
We are using the syslog module for logging, and would like to redirect stderr to our log. Is there a practical way to do it? I realize the logging module supports this and has a syslog writer, so that's a fallback. But we were hoping to use the syslog module for performance. -- Ru

How to output to syslog before /dev/log exists?

2012-12-31 Thread yanegomi
Basically I'm trying to write a snippet of code that outputs to both syslog and the console at boot on a FreeBSD box, and I'm not 100% sure how to direct the SysLogHandler to use the dmesg buffer instead of trying to use either localhost:514 (and failing silently), or use /de

Re: Redirecting stderr and stdout to syslog

2008-08-05 Thread Lincoln Yeoh
At 03:29 AM 8/6/2008, Matthew Woodcraft wrote: In article <[EMAIL PROTECTED]>, > How do I redirect ALL stderr stuff to syslog, even stderr from > external programs that don't explicitly change their own stderr? Sending messages to syslog involves more than writing to a fi

Re: Redirecting stderr and stdout to syslog

2008-08-05 Thread Matthew Woodcraft
In article <[EMAIL PROTECTED]>, > How do I redirect ALL stderr stuff to syslog, even stderr from > external programs that don't explicitly change their own stderr? Sending messages to syslog involves more than writing to a file descriptor, so there's no way to make this

Redirecting stderr and stdout to syslog

2008-08-05 Thread Lincoln Yeoh
Hi, I've just started to learn python (I've been using perl for some years). How do I redirect ALL stderr stuff to syslog, even stderr from external programs that don't explicitly change their own stderr? Say I have a program called foo: #!/usr/bin/python import syslog impor

Re: Syslog

2007-08-23 Thread Michael Bentley
On Aug 20, 2007, at 4:56 PM, greg wrote: > Hi All, > > Could anyone tell me how I could syslog to a specific log (e.g. /var/ > log/daemon.log, /var/log/syslog.log...)? > # something like this: import logging logging.basicConfig(level=logging.DEBUG, form

Re: Syslog

2007-08-20 Thread Hamish Moffatt
greg wrote: > Could anyone tell me how I could syslog to a specific log (e.g. /var/ > log/daemon.log, /var/log/syslog.log...)? > > Thanks very much in advance! It's up to your syslogd to route messages into particular files, based on their facility and/or priority. Check out /e

Syslog

2007-08-20 Thread greg
Hi All, Could anyone tell me how I could syslog to a specific log (e.g. /var/ log/daemon.log, /var/log/syslog.log...)? Thanks very much in advance! -Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: syslog best practices -- when to call closelog?

2006-07-11 Thread Cameron Laird
if the program crashes or is >killed without a closelog()? > >Jeff > In your terms, it's entirely safe to leave open the handle to syslog. The operating system takes responsibility for cleanup on shutdown of your application. -- http://mail.python.org/mailman/listinfo/python-list

syslog best practices -- when to call closelog?

2006-07-10 Thread J Rice
I have a question: When should syslog.closelog() be called? I have a daemon that spends most of its time asleep and quiet, but writes messages to the mail log when active. Should I open the log at the start and keep it open until the program closes? This seems much simpler than issuing three c

Re: is there a smaple to create syslog server on Windows.

2006-01-06 Thread LordLaraby
WIndows has a syslog server. It's called the Windows Event Log. No need to build a whole new one. *grin* Now... if you just want an app that listens on a log port and sends it's message to the Event Log, then I can't help you but to suggest that a *nix knowledgable programmer may

is there a smaple to create syslog server on Windows.

2006-01-04 Thread liujixuan
I am a new bie of Python. I knew there is module for syslog of Linux, but I want to create a syslog server on the windows server like windows 2k or 2k3, to collect the log message sent from our firewall. Any one has any idea about this? Many thanks. Jason Liu -- http://mail.python.org/mailman