Closed vojkny closed 4 years ago
Grails and Boot use logback so hence we chose it for familiarity purposes and unfamiliarity with log4j2. Other than that Micronaut is not really bound to logback, as we use slf4j for all logging. So swapping the implementation is actually quite easy an in fact we do it for deployment to AWS lambda for example. This could be as simple as a new CLI feature.
One more advantage is that when use write LogFactory.getLogger(currentClass)
, you don't need to write the currentClass
as it is inferred by reflection.
I would be happy for such feature.
We would have to review the impact of such as feature and how well log4j2 works with GraalVM native
It is true I had some reflection issues with GraalVM.
I have added log4j2 support with this pr https://github.com/micronaut-projects/micronaut-profiles/pull/217.
@benrhine the PR was already merged. Should this issue be still open?
@benrhine It seems that Micronaut already supports Log4j 2 as logging facade for Sl4fj (at least). However I still see this text in the documentation (since 1.1): https://docs.micronaut.io/latest/guide/index.html#introduction
The current default implementation for the logging system is LogbackLoggingSystem, which works with the logback logging framework. Additional logging systems will be implemented in future revisions of Micronaut.
I guess this text should be improved and include note about implemented support of other Slf4j logging facades.
Because now it just confuses the developers.
This is not a bug report, rather feature request or initiation of a discussion.
References
Motivation
log.fatal
which we use heavily within our project.LogFactory.getLogger(currentClass)
, you can just writeLogFactory.getLogger()
, as the current class is inferred by reflection.Questions