Re: [Tutor] Python logging

2009-04-19 Thread Kent Johnson
On Sun, Apr 19, 2009 at 3:18 PM, Scott SA wrote: > I guess I should really find the actual code and read what > it is doing... as Kent very gently prodded me with. It's in the Lib directory of your Python installation. > I did go through a few > PEPs too, and I don't recall seeing anything about

Re: [Tutor] Python logging

2009-04-19 Thread Scott SA
Hi Stephan & Kent, On Apr 19, 2009, at 6:12 AM, Stefan Behnel wrote: just commenting on this part: ... which basically says append WARNING messages to the rotating file handler in DatetimeLevelMessage format to a log-file named test_warn.log splitting the log-file when it exceeds 125829120

Re: [Tutor] Python logging

2009-04-19 Thread Stefan Behnel
Hi, just commenting on this part: Scott SA wrote: > [handler_warn_logfile] > class=handlers.RotatingFileHandler > level=WARNING > formatter=DatetimeLevelMessage > args=('test_warn.log', 'a', 125829120, 5) > filename=test_warn.log > mode=a > > ... which basically says

Re: [Tutor] Python logging

2009-04-19 Thread Kent Johnson
On Sat, Apr 18, 2009 at 5:07 PM, Scott SA wrote: > I want to re-direct the logs from python's logging library and while using a > config file rather than instantiating all of the logging within my actual > code. > > So, lets say I have a file log.conf that contains the various directives for > th

[Tutor] Python logging

2009-04-18 Thread Scott SA
Hi, For some reason, I'm having a bit of trouble figuring this one out. I know it has to be relatively easy but it just isn't "working" for me at the moment. I want to re-direct the logs from python's logging library and while using a config file rather than instantiating all of the loggi

Re: [Tutor] Python Logging Module

2009-04-07 Thread Kent Johnson
On Tue, Apr 7, 2009 at 6:34 PM, wrote: > Hello everyone... > > My intention is to create a generic logging function I can use across > scripts. I have a few things I would like this function to be able to > accomplish: > > 1. log info and above to console > 2. log debug and above to file > 3. for

[Tutor] Python Logging Module

2009-04-07 Thread chase . mp
Hello everyone... My intention is to create a generic logging function I can use across scripts. I have a few things I would like this function to be able to accomplish: 1. log info and above to console 2. log debug and above to file 3. format the output for each differently 4. allow areas

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-17 Thread Kent Johnson
Hans Fangohr wrote: > FYI: The reason for wanting to use two different file formats is this: > we have a somewhat larger project (http://nmag.soton.ac.uk) where we > combine high-level Python code with low-level Objective Caml code (and > a number of libraries). We would like to use the Python-logg

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-17 Thread Hans Fangohr
HI Riccardo, >>> >>> As far as I can see, the only reason in your example program to >>> open the >>> same file twice is to use two different formatters (i.e. two >>> different >>> type of lines) in the same log, >> Absolutely right. >> >>> if you'd drop the requirement for two >>> different f

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-17 Thread Ricardo Aráoz
Hans Fangohr wrote: Ricardo Aráoz wrote: > Kent Johnson wrote: >> I don't know the answer, but it has nothing to do with the logging >> module. The question is, can the same file reliably be opened >> twice for >> writing in the same module. > > Well, the question w

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-17 Thread Hans Fangohr
Ricardo Aráoz wrote: Why should it be all or nothing. Couldn't the programmer indicate that both handlers use the same file? It would be very easy to do this using StreamHandlers instead of FileHandlers. It would also be easy to make a FileHandler subclass that keeps a map from file name to fil

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-17 Thread Hans Fangohr
Ricardo Aráoz wrote: Kent Johnson wrote: I don't know the answer, but it has nothing to do with the logging module. The question is, can the same file reliably be opened twice for writing in the same module. Well, the question would actually be if the logging module is smart enough to find out

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-16 Thread Kent Johnson
Ricardo Aráoz wrote: > Why should it be all or nothing. Couldn't the programmer indicate that > both handlers use the same file? It would be very easy to do this using StreamHandlers instead of FileHandlers. It would also be easy to make a FileHandler subclass that keeps a map from file name to

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-16 Thread Ricardo Aráoz
Kent Johnson wrote: > Hans Fangohr wrote: >> Dear all, >> >> thanks to everybody who replied to my question. >> >> On 15 Dec 2007, at 16:34, Kent Johnson wrote: >> >>> Ricardo Aráoz wrote: > >> What is the recommended method to make such a suggestion to the python >> team, or the people who look

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-16 Thread Ricardo Aráoz
Hans Fangohr wrote: > Dear all, > > thanks to everybody who replied to my question. > > On 15 Dec 2007, at 16:34, Kent Johnson wrote: > >> Ricardo Aráoz wrote: >>> Kent Johnson wrote: I don't know the answer, but it has nothing to do with the logging module. The question is, can the sa

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-16 Thread Kent Johnson
Hans Fangohr wrote: > Dear all, > > thanks to everybody who replied to my question. > > On 15 Dec 2007, at 16:34, Kent Johnson wrote: > >> Ricardo Aráoz wrote: > What is the recommended method to make such a suggestion to the python > team, or the people who look after the logging module? You

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-16 Thread Hans Fangohr
Dear all, thanks to everybody who replied to my question. On 15 Dec 2007, at 16:34, Kent Johnson wrote: > Ricardo Aráoz wrote: >> Kent Johnson wrote: >>> I don't know the answer, but it has nothing to do with the logging >>> module. The question is, can the same file reliably be opened >>> twi

Re: [Tutor] python logging module: two handlers writing to the samefile - okay?

2007-12-15 Thread Tiger12506
- Original Message - From: "Hans Fangohr" <[EMAIL PROTECTED]> To: Sent: Saturday, December 15, 2007 1:43 AM Subject: [Tutor] python logging module: two handlers writing to the samefile - okay? > I have an example program (test.py) and the logging configurati

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-15 Thread Kent Johnson
Ricardo Aráoz wrote: > Kent Johnson wrote: >> I don't know the answer, but it has nothing to do with the logging >> module. The question is, can the same file reliably be opened twice for >> writing in the same module. > > Well, the question would actually be if the logging module is smart > eno

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-15 Thread Ricardo Aráoz
Kent Johnson wrote: > Hans Fangohr wrote: > >> (i) is this (as in the log.conf file) the right use of the logging >> module to achieve what I need? > > I think you understand the module correctly. > >> (ii) in particular, it appears we have two filehandlers that write to >> the same file (in mod

Re: [Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-15 Thread Kent Johnson
Hans Fangohr wrote: > (i) is this (as in the log.conf file) the right use of the logging > module to achieve what I need? I think you understand the module correctly. > (ii) in particular, it appears we have two filehandlers that write to > the same file (in mode 'a+'). While this seems to work

[Tutor] python logging module: two handlers writing to the same file - okay?

2007-12-14 Thread Hans Fangohr
Dear all, I am trying to set up a logging system with the following specs: - all messages should be printed to stdout and to a file (here called log.log). - we have two types of loggers that the code uses: 'normal' and 'short'. - The 'short' logger just prints less detail (it basically needs