1π
Is there a difference between the Django BaseCommand loggers and the logging logger?
Yes, a lot. stdout
and stderr
simply are I/O handlers that, by default, write to the standard output channel (stdout)Β [wiki] and standard error channel (stderr)Β [wiki]. These thus just write the content to these channels, and donβt do any formatting, have no log level that might be ommited, and can not work with multiple handlers.
This is in essence what the logging package does: it allows one to format it properly, to omit it depending on the log level, and let it handle it by (multiple) custom handlers. For example to write it to the output channel, save it to a file, insert it in a database, etc.
Does the Django BaseCommand logger use the logging module under the hood? If so, what level does
self.stdout
andself.stderr
use?
No, the logging
module has a handler that will, by default write to the output channel, although you can configure it to use a different handler.