By default I can enable logging in settings.py in the LOGGING
configuration by creating a logger ""
which will catch all logs. But what if I only want to see logging from my project's apps as opposed to Django internals?
I can imagine explicitly getting a logger in each of my Django app modules and naming it by some convention, e.g. logging.getLogger("myproject." + __file__)
. Then I can create a logger called 'myproject' (in SETTINGS) which picks up all of these to output. I'd prefer not to hardcode my project name, so I'd do some os.path logic on ___file___
to extract the full namespace up to the file at any arbitrary depth.
At this point, I stop and wonder is there an easier way?