configuration d'un "logging" via un fichier .ini
Bonjour,
Ayant trouvé dans la doc python, la possibilité de paramétrer les "logs":
http://docs.python.org/lib/logging-c...ileformat.html
J'ai crée le fichier de configuration suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| [loggers]
keys=root,simpleExample
[handlers]
keys=consoleHandler, fileAccessHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler, fileAccessHandler
[logger_simpleExample]
level=DEBUG
handlers=consoleHandler
qualname=simpleExample
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout,)
[handler_fileAccessHandler]
class = FileHandler
args=('trace.txt','a')
level = DEBUG
formatter = simpleFormatter
[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt= |
En fait j'ai ajouté le handler: "handler_fileAccessHandler".
Et là, j'ai une erreur:
Citation:
File "C:\Python25\lib\logging\config.py", line 194, in _install_loggers
log.addHandler(handlers[string.strip(hand)])
KeyError: 'fileAccessHandler'
Quelqu'un peut-il regarder mon fichier ?
Merci