How can I change the default Maven logger?

可紊 提交于 2019-12-24 12:38:39

问题


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:

  1. remove the slf4j-simple jar from the lib 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)
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!