`Logging.catch_exceptions` should be overridable for tests
It is very useful to know that loggers can't crash a program, but IMO during tests, one would prefer to know the logging is broken by getting an exception. Especially in the CI context, where usually don't inspect the logs if the CI run succeeded.
It would thus be useful if Logging.catch_exceptions could be toggled by an environment variable for testing purposes.
https://github.com/JuliaLang/julia/blob/9754dbbde5c0b39faa682c390668cf00f9a3df43/stdlib/Test/src/logging.jl#L47-L54
Thanks! My worry is that this wouldn't help code that changes the logger internally.
How do you suggest controlling such code from the outside?
Environment variable was my suggestion. If this convention catches on in the Logging module, I think it won't be too difficult for people to adapt their custom loggers as well, if they have an overload for catch_exceptions.
Hi, so for example
- Reuse
'JULIA_DEBUG'environment variable, with a new option called, say,'nocatchexceptions'. The default is messages are caught, so the non-default is this. - Change line 71 to being an if statement checking for the env variable.
- This is good for a use case where the logger needs to be modified after creation, which is possible?
I'm a new contributor btw! Hi!
👋 just wanna say, love your github name, @persinammon! 😁 Welcome to the project 😊
+1 to this request though. We want to set a blanket flag to make sure that tests in our build farm would always catch any case where someone introduces a typo that breaks a log-message, but we still don't want an untested typo in a log-message to kill production.