Open graemerocher opened 2 years ago
I don't think this is a good idea. The System.Logger
is pretty limited. Also see the JEP:
It is not a goal to define a general-purpose interface for logging. The service interface contains only the minimal set of methods that the JDK needs for its own usage.
Also, since System.Logger
does not provide an implementation on its own, we would still need logback, which requires slf4j anyway.
Yeah it is just here for consideration, it is pretty obvious at runtime slf4j and logback would still be needed, but if that could be made an optional dependency it means less is needed.
The question is do we need any of the features of these libraries in Micronaut Core.
It is clear that certain features (MDC comes to mind) are required for production level applications
We could also make our own logging adapter at that point
FYI:
Some comments about System.Logger
by Stuart Marks on Twitter: https://mobile.twitter.com/stuartmarks/status/1254819581585047552
It's mainly for the JDK itself, but it can also be used by anything that doesn't want to add a dependency for a logging facade.
The primary consumer is the JDK, but it’s public so anyone can use it. It seems useful for libraries that want to minimize dependencies.
That said, if one can live within the limitations of System.Logger, it's public, so it's fine for anyone to use.
Also, since
System.Logger
does not provide an implementation on its own
Just for reference, that's not quite correct. System.Logger
defaults to JUL as a backend. But granted, JUL is very limited in its capabilities.
I wonder which are such cool features in other logging frameworks not available in JUL and used in micronaut... Log4J vulnerability CVE-2021-45046 teaches to keep logging simple
@stefanofornari slf4j is a facade that allows users to pick their own logging framework. This is much more difficult with JUL. We do not want to force people to use JUL over other, more capable frameworks like logback.
Feature description
Since Java 9 SLF4J is no longer necessary and we should move logging to System.Logger
Ref https://www.baeldung.com/java-9-logging-api
This eliminates the need for an additional dependency