Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Masklinn
On 2 Feb 2010, at 17:52 , Jean-Michel Pichavant wrote: Masklinn wrote: Jean-Michel Pichavant wrote: To add a custom level, I would proceed that way: logging.ALERT = 45 logging.addLevelName(logging.ALERT, 'ALERT !!') logging.getLogger().log(logging.ALERT, 'test') Passing a string to

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Jean-Michel Pichavant
The reason is that log takes an *int* as first argument that defines the logging level. You gave a string. So There is definitely a reason for it to be incorrect. That's not a reason, that's just what currently happens. I know it doesn't work, and I know why, I went and checked the

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Masklinn
On 3 Feb 2010, at 11:50 , Jean-Michel Pichavant wrote: The reason is that log takes an *int* as first argument that defines the logging level. You gave a string. So There is definitely a reason for it to be incorrect. That's not a reason, that's just what currently happens. I know

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Jean-Michel Pichavant
Masklinn wrote: On 3 Feb 2010, at 11:50 , Jean-Michel Pichavant wrote: You don't neeed to check the code for that ! It is written in the documentation. The logging module designer choose to ask for a level, not a level name, possibly because 2 different levels can have the same name.

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Vinay Sajip
On Feb 3, 11:36 am, Masklinn maskl...@masklinn.net wrote: Well, Xavier, I would be the first to agree that the existing logging configuration API is not ideal. There are a number of reasons for the current ConfigParser schema used (e.g. an old GUI for configuring logging, which was there before

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-02 Thread Jean-Michel Pichavant
Masklinn wrote: When trying to load the following config file, I get an error ``ConfigParser.NoOptionError: No option 'handlers' in section: 'logger_0'`` (in both Python 2.6.4 and Python 3.1.1 on OSX, obviously ConfigParser is spelled configparser in 3.1): [loggers] keys=root,0

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-02 Thread Masklinn
Jean-Michel Pichavant wrote: To add a custom level, I would proceed that way: logging.ALERT = 45 logging.addLevelName(logging.ALERT, 'ALERT !!') logging.getLogger().log(logging.ALERT, 'test') Passing a string to the log method as you did is incorrect. I know it's currently incorrect. My point

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-02 Thread Jean-Michel Pichavant
Masklinn wrote: Jean-Michel Pichavant wrote: To add a custom level, I would proceed that way: logging.ALERT = 45 logging.addLevelName(logging.ALERT, 'ALERT !!') logging.getLogger().log(logging.ALERT, 'test') Passing a string to the log method as you did is incorrect. I know it's

Logging oddity: handlers mandatory in every single logger?

2010-02-01 Thread Masklinn
When trying to load the following config file, I get an error ``ConfigParser.NoOptionError: No option 'handlers' in section: 'logger_0'`` (in both Python 2.6.4 and Python 3.1.1 on OSX, obviously ConfigParser is spelled configparser in 3.1): [loggers] keys=root,0 [handlers]