Python logging (was Re: What should go to stdout/stderr and why Python logging write everything to stderr?)

2023-01-06 Thread Weatherby,Gerard
FWIW, it wasn’t too difficult to build a logging handler to send messages to Slack. https://pypi.org/project/slack-webclient-logger/ -- https://mail.python.org/mailman/listinfo/python-list

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-06 Thread Peter J. Holzer
some library is too chatty I'll add another logger to shut it up - no programming, just a few extra lines in a dict. (Instead of a config.py I might use a json file, especially if I expect the config to change often.) > I'm not at all surprised that the OP didn't understa

Re: asyncio and tkinter (was: What should go to stdout/stderr and why Python logging write everything to stderr?)

2023-01-05 Thread Thomas Passin
On 1/5/2023 7:52 PM, Stefan Ram wrote: Thomas Passin writes: On 1/5/2023 4:24 PM, Stefan Ram wrote: You often can replace threads in tkinter by coroutines using asyncio when you write a replacement for the mainloop of tkinter that uses asyncio. Now, try to read only the official documentation

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Thomas Passin
On 1/5/2023 4:24 PM, Stefan Ram wrote: You often can replace threads in tkinter by coroutines using asyncio when you write a replacement for the mainloop of tkinter that uses asyncio. Now, try to read only the official documentation of asyncio and tkinter and figure out only from this

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Thomas Passin
owto: >>> logging.basicConfig(level=logging.DEBUG) >>> logging.info('So should this') INFO:root:So should this : Finally! Not quite straightforward, though it is in the Howto. Now about those handlers ... From: Python-list on behalf of Grant Edwards Date: Thurs

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Grant Edwards
On 2023-01-05, Weatherby,Gerard wrote: > logging.basicConfig() > logging.info(“Nice to know”) > logging.debug(“Details for when things are funky”) > logging.warn(“Trouble is brewing”) I always seem to need something slightly more complex. Usually something like: * Specify a log level on the com

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Weatherby,Gerard
/stderr and why Python logging write everything to stderr? *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** On 2023-01-05, Thomas Passin wrote: > The logging system is so configurable that... I find it almost impossible to use unles

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Thomas Passin
I've been writing Python programs for over 20 years, and it's beyond me. I know what you mean! I have never used the Python logging package, but I inherited a java project that uses Log4j. Talk about obscure! The python docs are a wonder of clarity beside Log4j. So most of my Log4

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Grant Edwards
On 2023-01-05, Thomas Passin wrote: > The logging system is so configurable that... I find it almost impossible to use unless I copy a working example I find somewhere. ;) I'm not at all surprised that the OP didn't understand how it works. I've been writing Python programs for over 20 years, a

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Thomas Passin
On 1/5/2023 2:18 PM, Peter J. Holzer wrote: On 2023-01-05 08:31:40 -0500, Thomas Passin wrote: The logging system is so configurable that a user could set a different destination for each level of logging. So it seems that the O.P.'s original question about why the package's developers choose s

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Peter J. Holzer
On 2023-01-05 08:31:40 -0500, Thomas Passin wrote: > The logging system is so configurable that a user could set a different > destination for each level of logging. So it seems that the O.P.'s original > question about why the package's developers choose stderr for all levels can > be answered: "

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Thomas Passin
On 1/5/2023 6:27 AM, Peter J. Holzer wrote: On 2023-01-04 12:32:40 -0500, Thomas Passin wrote: On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: The logging module write everything to stderr no matter which logging level is used. The OP wrote this, but it's not so by default. By default it is

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-05 Thread Peter J. Holzer
On 2023-01-04 12:32:40 -0500, Thomas Passin wrote: > On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: > > The logging module write everything to stderr no matter which logging > > level is used. > > The OP wrote this, but it's not so by default. By default it is - sort of. That is all log message

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Chris Angelico
On Thu, 5 Jan 2023 at 05:06, Barry Scott wrote: > > > On 03/01/2023 21:24, c.bu...@posteo.jp wrote: > > Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: > >> logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) > > > > But I don't want to make all log levels go to stdout. Just

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Barry Scott
On 03/01/2023 21:24, c.bu...@posteo.jp wrote: Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) But I don't want to make all log levels go to stdout. Just DEBUG and INFO. But this would be a workaround. The main quest

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Barry Scott
On 03/01/2023 21:24, c.bu...@posteo.jp wrote: Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) But I don't want to make all log levels go to stdout. Just DEBUG and INFO. But this would be a workaround. The main quest

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Thomas Passin
On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: The logging module write everything to stderr no matter which logging level is used. The OP wrote this, but it's not so by default. There is a HOW-TO page that explains this and how to get the logging package to log everything to a file, along w

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Peter J. Holzer
On 2023-01-03 21:24:20 +, c.bu...@posteo.jp wrote: > The main question here is why does Python deciecded to make all logs go to > stderr? It doesn't. The Python logging system provides a plethora of handlers to log to lots of different places. Only the StreamHandler defaults to

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Peter J. Holzer
On 2023-01-04 16:46:37 +1100, Chris Angelico wrote: > On Wed, 4 Jan 2023 at 15:11, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > writing the FD is the same as using stdout > > > > Except stdout may be buffered. Maybe I'm overly lax in my terminology, but I frequently use the term "s

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Barry Scott
On 04/01/2023 06:46, Chris Angelico wrote: I've known some systems to have a trigger of "reading on FD 0 flushes FD 1" C++ has this feature: Quote from https://en.cppreference.com/w/cpp/io/cin "Once |std::cin| is constructed, std::cin.tie() returns &std::cout

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Barry Scott
On 04/01/2023 02:26, Chris Angelico wrote: Reading/writing the FD is the same as using stdout (technically you'd write to fd 1 and read from fd 0), but yes, can use /dev/tty to reach for the console directly. I think the logic is more like checking that stdin is a tty then using the tty it to

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread 2QdxY4RzWzUUiLuE
On 2023-01-04 at 12:02:55 +, "Weatherby,Gerard" wrote: > Dealing with stdout / stderr is bash is just syntax. I don’t always > remember it off the top of my head but … stackoverflow.com. https://tldp.org/LDP/abs/html/io-redirection.html > On Linux at least it’s possible to pipe to arbitrary

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Weatherby,Gerard
hael Torrie Date: Tuesday, January 3, 2023 at 5:18 PM To: python-list@python.org Subject: Re: What should go to stdout/stderr and why Python logging write everything to stderr? *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** M

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 17:26, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > > FDs can also be buffered. If it's buffering you want to avoid, don't > > mess around with exactly which one you're writing to, just flush. > > I meant to flush a C FILE stream or Python file before writing >

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Chris Angelico wrote: > > FDs can also be buffered. If it's buffering you want to avoid, don't > mess around with exactly which one you're writing to, just flush. I meant to flush a C FILE stream or Python file before writing directly to the file descriptor, in order to avoid out-of-se

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Grant Edwards wrote: > > That's definitely a better option, but I'm pretty sure I've seen > multiple examples over the decades where fd 0 was used instead. Was > /dev/tty a "recent" enough invention that I would have seen > application code that was written before it existed? Or maybe I

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 16:21, Grant Edwards wrote: > > On 2023-01-04, Chris Angelico wrote: > > On Wed, 4 Jan 2023 at 09:52, Grant Edwards > > wrote: > >> > >>> I can't think of a specific example, but I know I have piped the output > >>> of a program while at the same time interacting with a pr

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 15:11, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > > writing the FD is the same as using stdout > > Except stdout may be buffered. One should probably flush the buffer > before each raw write to the file descriptor. FDs can also be buffered. If it's buffering

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Grant Edwards
On 2023-01-04, Chris Angelico wrote: > On Wed, 4 Jan 2023 at 09:52, Grant Edwards wrote: >> >>> I can't think of a specific example, but I know I have piped the output >>> of a program while at the same time interacting with a prompt on stderr. >>> A rare thing, though. >> >> Programs that ask fo

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Chris Angelico wrote: > > writing the FD is the same as using stdout Except stdout may be buffered. One should probably flush the buffer before each raw write to the file descriptor. > use /dev/tty to reach for the console directly. On Windows, open "CON" (read or write), "CONIN$" (r

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 10:28, Stefan Ram wrote: > > c.bu...@posteo.jp writes: > >But I don't want to make all log levels go to stdout. Just DEBUG and > >INFO. > > The following was stripped down from something some guy > posted on a web site, maybe it was "rkachach". Yet another shining exampl

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 09:52, Grant Edwards wrote: > > On 2023-01-03, Michael Torrie wrote: > > On 1/3/23 11:45, Keith Thompson wrote: > >> MRAB writes: > >> [...] > >>> The purpose of stderr is to display status messages, logging and error > >>> messages, even user prompts, and not mess up the p

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Grant Edwards
On 2023-01-03, Michael Torrie wrote: > On 1/3/23 11:45, Keith Thompson wrote: >> MRAB writes: >> [...] >>> The purpose of stderr is to display status messages, logging and error >>> messages, even user prompts, and not mess up the program's actual >>> output. This is important on a *nix system w

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 09:17, Michael Torrie wrote: > > On 1/3/23 11:45, Keith Thompson wrote: > > MRAB writes: > > [...] > >> The purpose of stderr is to display status messages, logging and error > >> messages, even user prompts, and not mess up the program's actual > >> output. This is importan

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread 2QdxY4RzWzUUiLuE
On 2023-01-03 at 21:24:20 +, c.bu...@posteo.jp wrote: > The main question here is why does Python deciecded to make all logs > go to stderr? It makes sense to send all logging to one destination, and stderr is that place. > Maybe I totally misunderstood the intention of logging.info()?! Isn'

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Michael Torrie
On 1/3/23 11:45, Keith Thompson wrote: > MRAB writes: > [...] >> The purpose of stderr is to display status messages, logging and error >> messages, even user prompts, and not mess up the program's actual >> output. This is important on a *nix system where you might be piping >> the output of one

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 08:25, wrote: > > Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: > > logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) > > But I don't want to make all log levels go to stdout. Just DEBUG and > INFO. But this would be a workaround. But why are DEBUG

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Cameron Simpson
On Jan 3, 2023, at 10:38 AM, c.bu...@posteo.jp wrote: this posting isn't about asking for a technical solution. My intention is to understand the design decision Python's core developers made in context of that topic. The logging module write everything to stderr no matter which logging level i

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread c . buhtz
Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) But I don't want to make all log levels go to stdout. Just DEBUG and INFO. But this would be a workaround. The main question here is why does Python deciecded to make all

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Weatherby,Gerard wrote: > If sys.stdout is a tty, it typically flushes on newline. e. g. Sorry if I wasn't clear. Yes, a tty file will be buffered, but it's line buffering, which isn't an issue as long as lines are written to stdout. I was referring to full buffering of pipe and disk f

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Weatherby,Gerard
pt ends From: Python-list on behalf of Eryk Sun Date: Tuesday, January 3, 2023 at 1:33 PM To: c.bu...@posteo.jp Cc: python-list@python.org Subject: Re: What should go to stdout/stderr and why Python logging write everything to stderr? *** Attention: This is an external email. Use caution respo

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Thomas Passin
On 1/3/2023 11:51 AM, Stefan Ram wrote: Thomas Passin writes: On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: Also, I think it would be confusing to sometimes have logging output go to stdout and other times go to stderr. In UNIX, the output of a program can be redirected, so error messa

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Keith Thompson
MRAB writes: [...] > The purpose of stderr is to display status messages, logging and error > messages, even user prompts, and not mess up the program's actual > output. This is important on a *nix system where you might be piping > the output of one program into the input of another. I would ex

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, c.bu...@posteo.jp wrote: > > If the user request the usage info via "-h" it goes to stdout. The standard file for application output is sys.stdout. Note that sys.stdout may be buffered, particularly if it isn't a tty. When a file is buffered, writes are aggregated and only written to t

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Weatherby,Gerard
why Python logging write everything to stderr? *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** On 2023-01-03 15:35, c.bu...@posteo.jp wrote: > Hello, > > this posting isn't about asking for a technical solution. My int

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Richard Damon
 > On Jan 3, 2023, at 10:38 AM, c.bu...@posteo.jp wrote: > Hello, > > this posting isn't about asking for a technical solution. My intention > is to understand the design decision Python's core developers made in > context of that topic. > > The logging module write everything to stderr no mat

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread MRAB
On 2023-01-03 15:35, c.bu...@posteo.jp wrote: Hello, this posting isn't about asking for a technical solution. My intention is to understand the design decision Python's core developers made in context of that topic. The logging module write everything to stderr no matter which logging level is

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Thomas Passin
On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: Hello, this posting isn't about asking for a technical solution. My intention is to understand the design decision Python's core developers made in context of that topic. The logging module write everything to stderr no matter which logging level i

What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread c.buhtz
Hello, this posting isn't about asking for a technical solution. My intention is to understand the design decision Python's core developers made in context of that topic. The logging module write everything to stderr no matter which logging level is used. The argparse module does it more differe

Re: Anyone using cloud based monitoring/logging services with Python logging module?

2018-07-26 Thread Ben Finney
Malcolm Greene writes: > Looking for feedback on anyone who's using a cloud based > monitoring/logging service with Python's standard lib logging module, The free-software Sentry https://sentry.io/> is full-featured, implemented in PYthon, and available to set up on your own hosting or pay someo

Re: Anyone using cloud based monitoring/logging services with Python logging module?

2018-07-26 Thread Michael Vilain
I used DataDog. At the time, I didn't have any experience with python. I had to depend the company to make patches to things that didn't work. And anything custom, I just did a cron job instead of trying to integrate with their tool. They marketed themselves as a monitoring company but they r

Anyone using cloud based monitoring/logging services with Python logging module?

2018-07-26 Thread Malcolm Greene
Looking for feedback on anyone who's using a cloud based monitoring/logging service with Python's standard lib logging module, eg. services such as Datadog, Loggly, Papertrailapp, Scalyr, LogDNA, Logz.io, Logentries, Loggr, Logstats? Would appreciate hearing your experience, pros, cons, recommendat

Re: PYTHON LOGGING with StreamHandler and FileHandler

2014-11-25 Thread Peter Otten
Ganesh Pal wrote: > Thanks for the hint , I was able to get the error messages on the console > by setting the StreamHandler level to WARNING . > > It works for me know butone LAST question , it might sound simple, > but Iam not able to understand the difference between > > - (a) ch

Re: PYTHON LOGGING with StreamHandler and FileHandler

2014-11-25 Thread Ganesh Pal
Thanks for the hint , I was able to get the error messages on the console by setting the StreamHandler level to WARNING . It works for me know butone LAST question , it might sound simple, but Iam not able to understand the difference between - (a) ch.setLevel(logging.WARNING) and c

Re: PYTHON LOGGING with StreamHandler and FileHandler

2014-11-24 Thread dieter
Ganesh Pal writes: > The below program logs all the messages to the log file and displays the > same on the console . > > Please suggest how do I ensure that error and warning log levels go ONLY to > stdout and/or stder You read the handler related documentation of the logging module. When I rem

PYTHON LOGGING with StreamHandler and FileHandler

2014-11-24 Thread Ganesh Pal
Hi Team, The below program logs all the messages to the log file and displays the same on the console . Please suggest how do I ensure that error and warning log levels go ONLY to stdout and/or stder Code : import logging import sys # StreamHandler root = logging.getLogger() root.setLevel(lo

Re: Python Logging and printf()

2014-11-24 Thread Ganesh Pal
Hi Chris, Thanks for the comments , Iam planning to use logging handlers ( StreamHandler and FileHandler) to achieve my requirement . Any quick reference example to this will be great , Iam on Python 2.7 , Iam referring the python docs for mow. Regards, Ganesh On Fri, Nov 21, 2014 at 5:25 PM, C

Re: Python Logging and printf()

2014-11-21 Thread Chris Angelico
On Fri, Nov 21, 2014 at 9:48 PM, Ganesh Pal wrote: > Please provide your input on the below questions. > > (1). How do i guarantee that all console messages will be logged into the > logfile ? > (2) I feel the need to retain few print(), how do I ensure the print() > messages are also logged int

Re: Python Logging and printf()

2014-11-21 Thread Stéphane Wirtel
On 21 Nov 2014, at 11:48, Ganesh Pal wrote: Hi Team , Iam using the python logging module to log the events for my application into a log file . I have set the logging level to DEBUG as shown below logging.basicConfig(filename=options.log_file, level=logging.DEBUG

Python Logging and printf()

2014-11-21 Thread Ganesh Pal
Hi Team , Iam using the python logging module to log the events for my application into a log file . I have set the logging level to DEBUG as shown below logging.basicConfig(filename=options.log_file, level=logging.DEBUG, format='%(asct

RE: creating log file with Python logging module

2014-08-05 Thread Arulnambi Nandagoban
-Message d'origine- De : Python-list [mailto:python-list-bounces+a.nandagoban=traxens@python.org] De la part de Peter Otten Envoyé : Monday, August 4, 2014 4:03 PM À : python-list@python.org Objet : Re: creating log file with Python logging module Peter Otten wrote: > Pet

RE: how to fix python logging to not log to stderr

2014-08-05 Thread Arulnambi Nandagoban
-Message d'origine- De : Python-list [mailto:python-list-bounces+a.nandagoban=traxens@python.org] De la part de harish.chilk...@gmail.com Envoyé : Tuesday, August 5, 2014 11:18 AM À : python-list@python.org Objet : how to fix python logging to not log to stderr I am doing

how to fix python logging to not log to stderr

2014-08-05 Thread harish . chilkoti
I am doing this logging.basiConfig(logleve=Logging.Info) then i create a file log handler and attach to it. i also have propagate as True. My logs are going to the stderr as well. How do i fix so that logs don't go to stdout? -- https://mail.python.org/mailman/listinfo/python-list

Re: creating log file with Python logging module

2014-08-04 Thread Peter Otten
Peter Otten wrote: > Peter Otten wrote: > >> You won't see a rollover if you restart it. > > Sorry, I tried it and the above statement is wrong. [Arulnambi Nandagoban] > logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - > %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', level

Re: creating log file with Python logging module

2014-08-04 Thread Peter Otten
Peter Otten wrote: > You won't see a rollover if you restart it. Sorry, I tried it and the above statement is wrong. -- https://mail.python.org/mailman/listinfo/python-list

Re: creating log file with Python logging module

2014-08-04 Thread Peter Otten
Arulnambi Nandagoban wrote: > I am using logging module for my application to log all debug information. > I configured it create a new log file every day with > > "TimedRotatingFileHandler". I display debug message in console as well. > But I didn't see creation of new file. Is the script run

creating log file with Python logging module

2014-08-04 Thread Arulnambi Nandagoban
Hello all, I am using logging module for my application to log all debug information. I configured it create a new log file every day with "TimedRotatingFileHandler". I display debug message in console as well. But I didn't see creation of new file. Can someone help me to sort out this proble

Re: Python Logging: Specifying converter attribute of a log formatter in config file

2012-09-16 Thread Vinay Sajip
On Thursday, August 30, 2012 11:38:27 AM UTC+1, Radha Krishna Srimanthula wrote: > > Now, how do I specify the converter attribute (time.gmtime) in the above > section? Sadly, there is no way of doing this using the configuration file, other than having e.g. a class UTCFormatter(logging.Format

Re: Python Logging: Specifying converter attribute of a log formatter in config file

2012-08-30 Thread bernhard . haslhofer
I have the same problem and couldn't find a solution. It seems that converters can only be set programmatically? On Thursday, August 30, 2012 6:38:27 AM UTC-4, Radha Krishna Srimanthula wrote: > I'd like to have all timestamps in my log file to be UTC timestamp. When > specified through code,

Python Logging: Specifying converter attribute of a log formatter in config file

2012-08-30 Thread srimanthula . radhakrishna
I'd like to have all timestamps in my log file to be UTC timestamp. When specified through code, this is done as follows: myHandler = logging.FileHandler('mylogfile.log', 'a') formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(name)-15s:%(lineno)4s: %(message)-80s') formatter.converter

Re: python logging filter limitation, looks intentional?

2012-01-29 Thread Vinay Sajip
On Jan 28, 10:51 am, Chris Withers wrote: > To be clear, I wasn't asking for a change to existing behaviour, I was > asking for the addition of an option that would allow thelogging > framework to behave as most people would expect when it comes to filters ;-) And the evidence for "most people"

Re: python logging filter limitation, looks intentional?

2012-01-28 Thread Chris Withers
On 20/01/2012 20:09, Terry Reedy wrote: version upgrade. The proposed change isn't a new feature, it's a request for an existing feature to work differently. Thank you for the clarification. I had not gotten that the request was for a change, which has a much higher bar to pass than feature add

Re: python logging filter limitation, looks intentional?

2012-01-20 Thread Terry Reedy
On 1/20/2012 2:17 PM, Vinay Sajip wrote: On Jan 19, 12:50 am, Terry Reedy wrote: I don't want people to have to code differently for Python 3.3 and for older versions. This is not a general policy, else we would never add new features ;-) Do you plan to keep logging feature-frozen forever,

Re: python logging filter limitation, looks intentional?

2012-01-20 Thread Vinay Sajip
On Jan 19, 12:50 am, Terry Reedy wrote: > > >> I don't want people to have to code differently for Python 3.3 and for > >> older versions. > > This is not a general policy, else we would never add new features ;-) > Do you plan to keep logging feature-frozen forever, or just for another > release?

Re: python logging filter limitation, looks intentional?

2012-01-18 Thread Terry Reedy
On 1/18/2012 4:02 PM, Chris Withers wrote: On 17/01/2012 10:48, Vinay Sajip wrote: How about an option that defaults to "backwards compatibility mode" for Python 2.7, flipped the other way in 3.3? 2.7 only gets bug fixes, and this does not seem to be one. It's not a bug, because it's like

Re: python logging filter limitation, looks intentional?

2012-01-18 Thread Chris Withers
On 17/01/2012 10:48, Vinay Sajip wrote: From: Chris Withers How breaking code? Configuration, maybe, but I can't see anyone being upset that filtering would begin working "the same as everything else". This just feels like a bug... Well, it means that filters that don't get called now would

Re: python logging filter limitation, looks intentional?

2012-01-17 Thread Vinay Sajip
> From: Chris Withers > How breaking code? Configuration, maybe, but I can't see anyone being upset > that filtering would begin working "the same as everything else". > This just feels like a bug... Well, it means that filters that don't get called now would get called - and that's a change i

Re: python logging filter limitation, looks intentional?

2012-01-17 Thread Chris Withers
On 16/01/2012 23:21, Vinay Sajip wrote: Why is this? There must be some rationale for this rather than what, for me and others I've talked to, would seem more natural, ie: a filter on the root logger would get messages both logged to it and any messages propagated to it from child loggers to

Re: python logging module:a quick question

2011-12-27 Thread Lie Ryan
On 12/27/2011 05:26 PM, Littlefield, Tyler wrote: Hello all: I have a basic server I am working on, and wanted some input with an error I'm getting. I am initializing the logger like so: if __name__ == "__main__": observer = log.PythonLoggingObserver() observer.start() logging.basicConfig(filenam

python logging module:a quick question

2011-12-26 Thread Littlefield, Tyler
Hello all: I have a basic server I am working on, and wanted some input with an error I'm getting. I am initializing the logger like so: if __name__ == "__main__": observer = log.PythonLoggingObserver() observer.start() logging.basicConfig(filename='logs/server.log', level=logging.DEBUG,

Re: Stucked with python logging module

2011-11-15 Thread Kushal Kumaran
On Wed, Nov 16, 2011 at 8:58 AM, sword wrote: > I just scaned through the beginer's guide of logging module, but I > can't get anything from console. The demo just like this: > > import logging > logging.debug("This is a demo") > > Maybe I should do sth to put the log to stdout in basicConfig firs

Stucked with python logging module

2011-11-15 Thread sword
I just scaned through the beginer's guide of logging module, but I can't get anything from console. The demo just like this: import logging logging.debug("This is a demo") Maybe I should do sth to put the log to stdout in basicConfig first? Thanks in advance -- http://mail.python.org/mailman/lis

Re: python logging multiple processes to one file (via socket server)

2011-10-27 Thread 88888 Dihedral
Well, please check the byte code compiled results. This is useful. I know that a lot people are working on increasing the speed of execution scripts written in python, say, psyco, pyrex for packages released! -- http://mail.python.org/mailman/listinfo/python-list

Re: python logging multiple processes to one file (via socket server)

2011-10-27 Thread bobicanprogram
On Oct 27, 6:09 am, Gelonida N wrote: > Hi, > > I have a rather 'simple' problem. > Logging from multiple processes to the same file AND be sure, that no > log message is lost, > > 1.) Log multiple processes to one file: > -- > > I have a python program, whi

Re: python logging multiple processes to one file (via socket server)

2011-10-27 Thread Vinay Sajip
On Oct 27, 11:09 am, Gelonida N wrote: > "The following section documents this approach in more detail and > includes a working socket receiver which can be used as a starting point > for you to adapt in your own applications." > > Somehow I have a mental block though and fail to see the 'followin

python logging multiple processes to one file (via socket server)

2011-10-27 Thread Gelonida N
Hi, I have a rather 'simple' problem. Logging from multiple processes to the same file AND be sure, that no log message is lost, 1.) Log multiple processes to one file: -- I have a python program, which I want to log, but which forks several times. Due

Re: python logging

2011-05-19 Thread Vinay Sajip
On May 18, 11:42 pm, Ian Kelly wrote: > I was wrong, it's more complicated than that. > > >>>logging.getLogger('log').warning('test') > > No handlers could be found for logger "log">>>logging.warning('test') > WARNING:root:test > >>>logging.getLogger('log').warning('test') > > WARNING:log:test > >

Re: python logging

2011-05-19 Thread Rafael Durán Castañeda
You are right that behavior isn't documented and might be a bug. You could report it. Bye El 19 de mayo de 2011 00:42, Ian Kelly escribió: > 2011/5/18 Ian Kelly : > > Ah, that's it. I was using Python 2.5. Using 2.7 I get the same > > result that you do. > > > > Still, it's a surprising chang

Re: python logging

2011-05-18 Thread Ian Kelly
2011/5/18 Ian Kelly : > Ah, that's it.  I was using Python 2.5.  Using 2.7 I get the same > result that you do. > > Still, it's a surprising change that doesn't seem to be documented as > such.  I'm not sure whether it's a regression or an intentional > change. I was wrong, it's more complicated t

Re: python logging

2011-05-18 Thread Ian Kelly
2011/5/18 Rafael Durán Castañeda : > Are you using python 2.x or 3.x? At python 2.7 using: > > import logging > logging.getLogger('log').warning('test') > > I got: > > No handlers could be found for logger "log" Ah, that's it. I was using Python 2.5. Using 2.7 I get the same result that you do.

Re: python logging

2011-05-18 Thread Vinay Sajip
On May 18, 11:10 pm, Ian Kelly wrote: > It seems to work without any configuration just as well as the root logger: > > >>> importlogging > >>>logging.getLogger('foo').warning('test') > > WARNING:foo:test > > Or am I misunderstanding you? In general for Python 2.x, the code import logging loggi

Re: python logging

2011-05-18 Thread Rafael Durán Castañeda
On 19/05/11 00:10, Ian Kelly wrote: 2011/5/18 Rafael Durán Castañeda: I think you are confuse because of you are looking at advanced logging, where getLogger is being used. Simple logging works without any configuration, getLogger doesn't. It seems to work without any configuration just as well

Re: python logging

2011-05-18 Thread Ian Kelly
2011/5/18 Rafael Durán Castañeda : > I think you are confuse because of you are looking at advanced logging, > where getLogger is being used. Simple logging works without any > configuration, getLogger doesn't. It seems to work without any configuration just as well as the root logger: >>> import

Re: python logging

2011-05-18 Thread Rafael Durán Castañeda
On 18/05/11 23:29, Ian Kelly wrote: 2011/5/18 Rafael Durán Castañeda: That's not exactly how it works. You can use logging without any configuration and the default output will be console. In addition default logging level is warning, so: logging.info("Some text") won't show anything and log

Re: python logging

2011-05-18 Thread Ian Kelly
2011/5/18 Rafael Durán Castañeda : > That's not exactly how it works. You can use logging without any > configuration and the default output will be console. In addition default > logging level is warning, so: > > logging.info("Some text") > > won't  show anything and > > logging.warning("Other tex

Re: python logging

2011-05-18 Thread Rafael Durán Castañeda
On 18/05/11 03:09, Fei wrote: On May 17, 6:55 pm, Ian Kelly wrote: On Tue, May 17, 2011 at 2:55 PM, Fei wrote: where is default logging file on Mac? I saw lots of app just import logging, and begins to logging.info(...) etc. I'm not sure where to look at the logging configuration to figure o

Re: python logging

2011-05-17 Thread Fei
On May 17, 6:55 pm, Ian Kelly wrote: > On Tue, May 17, 2011 at 2:55 PM, Fei wrote: > > where is default logging file on Mac? I saw lots of app just import > > logging, and begins to logging.info(...) etc.  I'm not sure where to > > look at the logging configuration to figure out the log location.

Re: python logging

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 2:55 PM, Fei wrote: > where is default logging file on Mac? I saw lots of app just import > logging, and begins to logging.info(...) etc.  I'm not sure where to > look at the logging configuration to figure out the log location. There is no default log file. You're seeing

Re: python logging

2011-05-17 Thread Rafael Durán Castañeda
On 17/05/11 22:55, Fei wrote: where is default logging file on Mac? I saw lots of app just import logging, and begins to logging.info(...) etc. I'm not sure where to look at the logging configuration to figure out the log location. I just get in touch of python about 1month ago, and I appreciat

python logging

2011-05-17 Thread Fei
where is default logging file on Mac? I saw lots of app just import logging, and begins to logging.info(...) etc. I'm not sure where to look at the logging configuration to figure out the log location. I just get in touch of python about 1month ago, and I appreciate your help. -- http://mail.pyt

  1   2   >