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

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 configuration file > (log.conf) attache

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