[issue15616] logging.FileHandler not correctly created with PyYaml (unpickling problems?)
Jordi Puigsegur
report at bugs.python.org
Fri Aug 10 12:50:32 CEST 2012
Jordi Puigsegur added the comment:
import logging
import logging.handlers
import yaml
logger = logging.getLogger() # root logger
# Option 1 - OK
##handler = logging.handlers.RotatingFileHandler(filename = "test.log", maxBytes = 262144, backupCount = 3)
# Option 2 - RotatingFileHandler fails when created through yaml
handler = yaml.load("""
!!python/object/new:logging.handlers.RotatingFileHandler
kwds:
filename: test.log
maxBytes: 262144
backupCount: 3
""")
# Option 3 - FileHandler also fails when created through yaml
##handler = yaml.load("""
##!!python/object/new:logging.FileHandler
## kwds:
## filename: test.log
##""")
logger.addHandler(handler)
logger.warning("test handler")
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15616>
_______________________________________
More information about the Python-bugs-list
mailing list