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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -