micronaut-projects / micronaut-core

Micronaut Application Framework
http://micronaut.io
Apache License 2.0
6.05k stars 1.06k forks source link

Support Log4j2 feature in the CLI #1621

Closed vojkny closed 4 years ago

vojkny commented 5 years ago

This is not a bug report, rather feature request or initiation of a discussion.

References

Motivation

Questions

graemerocher commented 5 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.

vojkny commented 5 years ago

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.

graemerocher commented 5 years ago

We would have to review the impact of such as feature and how well log4j2 works with GraalVM native

vojkny commented 5 years ago

It is true I had some reflection issues with GraalVM.

benrhine commented 4 years ago

I have added log4j2 support with this pr https://github.com/micronaut-projects/micronaut-profiles/pull/217.

renannprado commented 4 years ago

@benrhine the PR was already merged. Should this issue be still open?

sergey-morenets commented 3 years ago

@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.