问题
I'm trying to change the simple logger that Maven uses by default and change it for Log4j2.
I've tried adding the jars of the new logger to the Maven lib
but it did not work.
Does any one know how to migrate from the simple logger to a newest version of the logger?
回答1:
Maven uses SLF4J API to log messages. By default, it uses slf4j-simple
implementation. If you want to change this logging implementation, you just need to modify your Maven installation like this:
- remove the
slf4j-simple
jar from thelib
directory of your Maven installation (you might also want to rename it to.old
, in case you want to roll it back in the future) - replace it with one of the alternative implementations (Log4j 2 SLF4J Binding in your case)
The configuration of the logger is then exactly the same as before (documented here).
来源:https://stackoverflow.com/questions/33629169/how-can-i-change-the-default-maven-logger