Reputation: 1405
I use django 1.6 and python 3.2 in Ubuntu 12.04.And i find django logging is using the python's built-in logging module.As the dictConfig format(python 3.x version) said, I can use 3 kind format style in setting logging formatter(the %-formatting, {}-formatting, and the $()-formating) while django uses dictConfig format(python 2.x version) as document.
So can I use different kind of format style in django logging?
like:
{
'format':"{levelname} - {asctime} - {module} - {process} - {thread} - {message}"
}
instead of
{
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
}
in django 1.6?
Upvotes: 3
Views: 356
Reputation: 99530
You should be able to do this, because you control the formatters that you use. Just specify a suitable style
value in the dict which defines the formatter parameters, e.g.
{
"format": "{levelname} - {asctime} - {module} - {message}",
"style": "{",
}
Update: You need to specify the formatter with this dict, for Python 3.2:
{
'()': logging.Formatter,
'format': '{levelname} - {asctime} - {module} - {message}',
'style': '{',
},
On Python 3.3 or later, the '()': logging.Formatter
line shouldn't be needed.
Upvotes: 2