简体   繁体   中英

How to limit logging of tomcat7-maven-plugin

I'm using the tomcat7-maven-plugin for integration testing my app. Unfortunately, it spams WAY too much stuff to the console. I'm getting debug level stuff from spring, and tons of other stuff. What is the easiest way to limit the output to INFO level including spring and other dependencies?

Provide a relevant logging configuration. I'm looking at a project that essentially depends on Log4j (it also uses SLF4J-Log4j so that dependencies that use SLF4J will still essentially use Log4j).

For this project I add a log4j.xml on the classpath. Maven, so that'd be in src/main/resources (which will be packaged into WEB-INF/classes ).

My log4j.xml defines a bunch of appender s, but your real ask is about dialing back the logging. That is done using loggers and a root logger. Just some example snippets...:

<logger name="com.mydomain">
    <level value="INFO" />
</logger>

<root>
    <level value="WARN" />
    <appender-ref ref="ASYNC-MAIN" />
</root>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM