如何从Maven插件'tomcat7-maven-plugin'配置嵌入式Tomcat的日志记录

use*_*900 10 configuration logging tomcat

我正在使用Maven 3.0.4和tomcat7-maven-plugin嵌入式Tomcat服务器.我想通过编辑pom.xml来生成服务器日志.但是,我无法在配置部分中使用"tomcatLoggingFile"属性获取任何日志.以下是我的配置:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <tomcatLoggingFile>tomcat_server.log</tomcatLoggingFile>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

我已经检查了tomcat7-maven-plugin的官方文档:http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/run-mojo.html 但是仍然不知道为什么它不是工作.

此外,我已经检查了这篇文章:从Maven插件配置嵌入式Tomcat的日志记录, 而是使用org.slf4j.LoggerFactory.在tomcat_server.log文件中找不到任何日志.

当我在pom.xml中切换回使用jboss-as-maven-plugin并运行时mvn jboss-as:run,可以在目标文件夹中成功生成server.log.

有什么建议吗?

Mat*_*s M 2

文档说, tomcatLoggingFile 指的是“Tomcat 日志记录配置的路径”,而不是日志文件本身。此外,您还应确保日志记录库位于类路径上。请参阅http://tomcat.apache.org/tomcat-7.0-doc/logging.html