Skip to content
Advertisement

How to create a specific logger for my message?

I have spent far too much time on this and I couldn’t figure out by myself.

I am writing some code that use some modules, so I want to create a specific logger for my message, not those from the other modules (they are far too many so I don’t want to set a different level for each of them).

I have simplified my use case to:

JavaScript

When I execute the previous code, I would expect to have my info message logged.

Instead I got:

JavaScript

Same with DEBUG, it always print warning/error/critical messages, not the debug/info.

If I raise the logging level (let’s say ERROR), it works as expected.

JavaScript

Advertisement

Answer

Change the configuration at the package level / root logger (documentation).

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement