我已将日志设置为" info"通过log4j.xml在我的应用程序中的级别。 但是,当应用程序加载时,我可以看到调试级别的日志。 这是我的log4j.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration APP_DEBUG="false">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%5p %d{ISO8601} [%t][%x] %c - %m%n" />
</layout>
</appender>
<appender name="monitoringApp" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="file" value="${catalina.base}/logs/monitor.log" />
<param name="append" value="true" />
<param name="encoding" value="UTF-8" />
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${catalina.base}/logs/%d{yyyy-MM-dd_HH}_monitor.gz" />
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%5p | %d{ISO8601} | [%t][%x] | %c:%L | %m%n" />
</layout>
</appender>
<root>
<priority value="info" />
<appender-ref ref="monitoringApp" />
<!-- <appender-ref ref="CONSOLE" /> -->
</root>
</log4j:configuration>
这是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bng</groupId>
<artifactId>monitor</artifactId>
<packaging>war</packaging>
<version>0</version>
<name>monitor Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>4.2.8.RELEASE</spring.version>
<springsecurity.version>3.2.0.RELEASE</springsecurity.version>
<log4j.version>1.2.17</log4j.version>
<commons.fileupload.version>1.3.1</commons.fileupload.version>
<commons.io.version>2.4</commons.io.version>
<springsocial.version>1.1.0.RELEASE</springsocial.version>
</properties>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>apache-log4j-extras</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.6.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.6.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.2.6.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.2.6.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3.21</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<!-- EXCEL -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jolbox</groupId>
<artifactId>bonecp</artifactId>
<version>0.8.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.3</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160212</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.9.4.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>monitor</finalName>
</build>
</project>
这是console.log
INFO | 2016-11-28 16:42:18,072 | [localhost-startStop-1] [] | org.springframework.web.context.ContextLoader:273 | Root WebApplicationContext:初始化已启动 调试| 2016-11-28 16:42:18,178 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:112 |初始化新的StandardServletEnvironment 调试| 2016-11-28 16:42:18,180 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:107 |添加具有最低搜索优先级的[servletConfigInitParams] PropertySource 调试| 2016-11-28 16:42:18,181 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:107 |添加具有最低搜索优先级的[servletContextInitParams] PropertySource 调试| 2016-11-28 16:42:18,185 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:107 |添加[jndiProperties] PropertySource,搜索优先级最低 调试| 2016-11-28 16:42:18,186 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:107 |添加具有最低搜索优先级的[systemProperties] PropertySource 调试| 2016-11-28 16:42:18,188 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:107 |添加具有最低搜索优先级的[systemEnvironment] PropertySource 调试| 2016-11-28 16:42:18,189 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:116 |使用PropertySources初始化StandardServletEnvironment [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment] 信息| 2016-11-28 16:42:18,190 | [localhost-startStop-1] [] | org.springframework.web.context.support.XmlWebApplicationContext:510 |刷新根WebApplicationContext:启动日期[Mon Nov 28 16:42:18 IST 2016];上下文层次结构的根 调试| 2016-11-28 16:42:18,195 | [localhost-startStop-1] [] | org.springframework.web.context.support.StandardServletEnvironment:172 |用[servletContextInitParams]替换[servletContextInitParams] PropertySource 调试| 2016-11-28 16:42:18,258 | [localhost-startStop-1] [] | org.springframework.core.env.StandardEnvironment:112 |初始化新的StandardEnvironment 调试| 2016-11-28 16:42:18,259 | [localhost-startStop-1] [] | org.springframework.core.env.StandardEnvironment:107 |添加具有最低搜索优先级的[systemProperties] PropertySource 调试| 2016-11-28 16:42:18,259 | [localhost-startStop-1] [] | org.springframework.core.env.StandardEnvironment:107 |添加具有最低搜索优先级的[systemEnvironment] PropertySource 调试| 2016-11-28 16:42:18,259 | [localhost-startStop-1] [] | org.springframework.core.env.StandardEnvironment:116 |使用PropertySources初始化StandardEnvironment [systemProperties,systemEnvironment] 信息| 2016-11-28 16:42:18,269 | [localhost-startStop-1] [] | org.springframework.beans.factory.xml.XmlBeanDefinitionReader:315 |从ServletContext资源加载XML bean定义[/WEB-INF/application-context.xml]
有人可以帮帮我吗?我已经尝试了堆栈溢出中描述的所有解决方案。