qos-ch / slf4j

Simple Logging Facade for Java
http://www.slf4j.org
MIT License
2.32k stars 980 forks source link

No-op logger is not a sane default #387

Open sesm opened 7 months ago

sesm commented 7 months ago

If no SLF4J providers are found, SLF4J defaults to no-op logger, which results in all logs, including errors and exceptions being hidden.

IMO this is not a sane default, a better default would be logging exceptions, errors and warning to stdout. stdout is perfectly fine for development and became a common practice for Docker containers in production.

The codebase already has SimpleLogger that does this, but when I tried to reference it in slf4j.LoggerFactory it introduced a circular dependency. Maybe it makes sense to copy SimpleLogger to base package, remove all extra code for configurability/etc, call it FallbackStdoutLogger and use it by default?