python - How to Customize the time format using logging.config.fileConfig() -
i using python logging module write log files:
logging.config.fileconfig(log_conf_file)
the formatter section in log_conf_file "logging.conf" looks like:
[formatter_mylog] format: %(asctime)s %(message)s
this makes log looks like:
2013-05-02 13:39:55,325 mesagebody blablablabla
how can customize asctime format output like:
may 02 13:39:55 mesage_body blablablabla
i know if it's in python code, can like:
# create formatter formatter = logging.formatter("%(asctime)s;%(message)s", "%y-%m-%d %h:%m:%s")
but how do via logging configuration file ?
try this:
[formatter_mylog] format: %(asctime)s %(message)s datefmt=%m-%d %h:%m:%s
not sure if change month verbal style.
update:
to implement verbal style of month try use %b
(source)
Comments
Post a Comment