Python 3.6 Logging time is not listed
On Monday, 13 August 2018 19:42:57 UTC+2, L?o El Amri wrote:
> 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."
That is a bit odd. I would have thought that multiple calls to
logging.basicConfig with different parameters would have been acceptable.
So something like
would presumably be accepted?