I'm using Maven 3.0.4 with tomcat7-maven-plugin for embedded Tomcat server. I would like to generate the server log through editing pom.xml. However, I can't get any log with the "tomcatLoggingFile" property in the configuration section. Below is my configuration:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<tomcatLoggingFile>tomcat_server.log</tomcatLoggingFile>
</configuration>
</plugin>
I've checked the official documentation for tomcat7-maven-plugin: http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/run-mojo.html but still don't know why it's not working.
Also, I've checked this post: Configuring Logging for an Embedded Tomcat from Maven plugin and use org.slf4j.LoggerFactory instead. There is no any log found in the file tomcat_server.log.
When I switch back to use jboss-as-maven-plugin in pom.xml and run mvn jboss-as:run
, the server.log can be generated inside target folder successfully.
Any suggestion?
The documentations says, that tomcatLoggingFile refers to "the path of the Tomcat logging configuration", not the logging file itself. Besides you shall ensure, that the logging libraries are on the classpath. See http://tomcat.apache.org/tomcat-7.0-doc/logging.html
The logging configuration for Embedded Tomcat Maven is currently broken due to bug
https://issues.apache.org/jira/browse/MTOMCAT-127
The workaround is to simply redirect the stdout, like:
mvn tomcat7:run 2>&1 | tee catalina.out
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With