You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect this to print the log message, because I am using a custom task-local logger, and I expected my custom logger to override any global behavior. However, this MWE will result in no logs being printed.
Workaround
Here's a workaround:
using Logging: Logging, @logmsg, LogLevel, with_logger, ConsoleLogger
+ Logging.disable_logging(Logging.BelowMinLevel)
with_logger(ConsoleLogger(LogLevel(-5_000))) do
@logmsg LogLevel(-3_000) "hello world"
end
With the workaround, the log message is printed:
┌ LogLevel(-3000): hello world
└ @ Main REPL[3]:2
I still think this is a bug though. IMO, when using a custom logger (e.g. with with_logger() do ...), the min_level of the custom logger should be the only thing that matters, and the global settings should not prevent log messages from being printed.
DilumAluthge
changed the title
Log messages below -1_000 are ignored, even when a custom task-local logger is used
Log messages below LogLevel(-1_000) are ignored, even when a custom task-local logger is used
Nov 19, 2023
MWE:
I would expect this to print the log message, because I am using a custom task-local logger, and I expected my custom logger to override any global behavior. However, this MWE will result in no logs being printed.
Workaround
Here's a workaround:
using Logging: Logging, @logmsg, LogLevel, with_logger, ConsoleLogger + Logging.disable_logging(Logging.BelowMinLevel) with_logger(ConsoleLogger(LogLevel(-5_000))) do @logmsg LogLevel(-3_000) "hello world" end
With the workaround, the log message is printed:
I still think this is a bug though. IMO, when using a custom logger (e.g. with
with_logger() do ...
), the min_level of the custom logger should be the only thing that matters, and the global settings should not prevent log messages from being printed.Related issues
Related: #34037
The text was updated successfully, but these errors were encountered: