how to use logging.config.fileConfig ?
Alexandru Moșoi
brtzsnr at gmail.com
Fri Apr 10 10:51:43 EDT 2009
Hello,
I have a problem using logging the library. I copied and modified the
example from PEP 282 [0], [1], [2], [3].
If I use logging.basicConfig() everything works fine. If I use
logging.config.fileConfig() my loggers get disabled. I checked logging/
config.py and I found a big comment saying that old loggers are
disabled! Why? What am I doing wrong? How do I use
logging.config.fileConfig() to avoid this problem ?
with logging.config.fileconfig()
--------------------
2009-04-10 17:49:19,955:MyApp:INFO - Starting my app
2009-04-10 17:49:19,955:MyApp:ERROR - There was a problem.
Traceback (most recent call last):
File "myapp.py", line 10, in <module>
mymodule.doIt()
File "/home/voodoo/src/mymodule.py", line 7, in doIt
raise TypeError, "Bogus type error for testing"
TypeError: Bogus type error for testing
2009-04-10 17:49:19,956:MyApp:INFO - Ending my app
----------------------
with logging.basicConfig()
----------------------
INFO:MyApp:Starting my app
DEBUG:MyModule:Doin' stuff...
ERROR:MyApp:There was a problem.
Traceback (most recent call last):
File "myapp.py", line 10, in <module>
mymodule.doIt()
File "/home/voodoo/src/mymodule.py", line 7, in doIt
raise TypeError, "Bogus type error for testing"
TypeError: Bogus type error for testing
INFO:MyApp:Ending my app
----------------------
[0] http://rafb.net/p/nl7b7m19.html
[1] http://rafb.net/p/n6KNdU44.html
[2] http://rafb.net/p/OxyTga98.html
[3] http://www.python.org/dev/peps/pep-0282/
More information about the Python-list
mailing list