2

Everything works fine when deployed to Tomcat server & application logs get printed.But when I use mvn tomcat7:run no application logs are getting printed. My configurations are as follows:

web.xml

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>classpath:log4j-shoppingcart.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

pom.xml

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <systemProperties>
            <java.util.logging.config.file>src/main/resources/log4j-shoppingcart.xml</java.util.logging.config.file>
        </systemProperties>
        <extraDependencies>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.7</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jul-to-slf4j</artifactId>
                <version>1.7.7</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactI>
                <version>1.7.7</version>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>
        </extraDependencies>
    </configuration>
</plugin>

The links helped me to some extent but no application logs gets printed. Any help would be of great help.

Community
  • 1
  • 1

0 Answers0