logger.add("/var/log/protectwise_bootstrap.log", backtrace=False, format="{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}")
backtrace=False, but loguru is still showing tracebacks on exceptions

Setting the env variable "export LOGURU_BACKTRACE=NO" seems to quiet the backtraces, but "backtrace=False" doesn't seem to turn them off. Python 3.6.8
Hi.
I guess you have two configured handlers: the first one logs messages to sys.stderr (this is the default handler automatically added), the second one logs messages to "protectwise_bootstrap.log" (the handler you manually added).
The backtrace properties of handlers are independent of each others. The default handler use backtrace=True. So, even if you add a new handler with logger.add(..., backtrace=False), the default one is not modified and will display full traceback.
You can either set LOGURU_BACKTRACE=NO for development, or explicitly add a sys.stderr handler with backtrace=False:
logger.remove() # Remove default handler (and all others)
logger.add(sys.stderr, backtrace=False)
logger.add("protectwise_bootstrap.log", backtrace=False, format="{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}")
Alternatively, using configure():
# Default handler (and all others) is automatically removed while using '.configure()'
logger.configure(handlers=[
{"sink": sys.stderr, "backtrace": False},
{"sink": "protectwise_bootstrap.log", "backtrace": False, "format": "{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}"}
])
Thanks for your help. Really really lovely loggly module.
Most helpful comment
Hi.
I guess you have two configured handlers: the first one logs messages to
sys.stderr(this is the default handler automatically added), the second one logs messages to"protectwise_bootstrap.log"(the handler you manually added).The
backtraceproperties of handlers are independent of each others. The default handler usebacktrace=True. So, even if you add a new handler withlogger.add(..., backtrace=False), the default one is not modified and will display full traceback.You can either set
LOGURU_BACKTRACE=NOfor development, or explicitly add asys.stderrhandler withbacktrace=False:Alternatively, using
configure():