Python 3.6 Logging time is not listed
Léo El Amri
leo at superlel.me
Mon Aug 13 13:42:33 EDT 2018
On 13/08/2018 19:23, MRAB wrote:
> Here you're configuring the logger, setting the name of the logfile and
> the logging level, but not specifying the format, so it uses the default
> format:
>
>> logging.basicConfig(filename='example.log',level=logging.DEBUG)
>
> Here you're configuring the logger again, this time specifying the
> format and the logging level, but not a path of a logging file, so it'll
> write to the console:
>
>> logging.basicConfig(format='%(asctime)s;%(levelname)s:%(message)s',
>> level=logging.DEBUG)
>
> The second configuration is overriding the first.
No, the second is not overriding the first one. The second call simply
does nothing at all. See
https://docs.python.org/3/library/logging.html#logging.basicConfig :
"This function does nothing if the root logger already has handlers
configured for it."
More information about the Python-list
mailing list