我有关于log4j日志记录的问题。我正在使用logback并在日志中选择并查看配置,但之后没有任何内容进入控制台或文件(logging.log文件已创建但为空)。我使用的是org.eclipse.jetty jetty-maven-plugin版本9.2.13.v20150730。
这是maven插件配置:
<configuration>
<webAppSourceDirectory>${project.basedir}/src/main/webapp/</webAppSourceDirectory>
<jettyXml>src/test/resources/jetty-http.xml</jettyXml>
<jvmArgs>-Xmx1024m -Xms1024m -XX:PermSize=96m -XX:MaxPermSize=128m</jvmArgs>
<scanIntervalSeconds>10</scanIntervalSeconds>
<useTestClasspath>true</useTestClasspath>
<webApp>
<contextPath>/web-server</contextPath>
<descriptor>${project.basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
<overrideDescriptor>${project.basedir}/src/test/resources/jetty-web.xml</overrideDescriptor>
</webApp>
<contextXml>src/test/resources/jetty-env.xml</contextXml>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
<systemProperties>
<systemProperty>
<name>logback.configurationFile</name>
<value>src/test/resources/logback-test.xml</value>
</systemProperty>
</systemProperties>
</configuration>
我从logback获得的唯一日志是:
logs from jetty starting before this line...
avg 19, 2015 10:37:00 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]
10:37:00,763 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [src/test/resources/logback-test.xml] at [file:/home/matjaz/workspaces/andWspc/my-base/web-server/src/test/resources/logback-test.xml]
10:37:00,792 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
10:37:00,793 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
10:37:00,799 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
10:37:00,812 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
10:37:00,838 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
10:37:00,840 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [QUICK_LOG]
10:37:00,845 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
10:37:00,845 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[QUICK_LOG] - No TriggeringPolicy was set for the RollingFileAppender named QUICK_LOG
10:37:00,845 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[QUICK_LOG] - For more information, please visit http://logback.qos.ch/codes.html#rfa_no_tp
10:37:00,846 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
10:37:00,846 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [QUICK_LOG] to Logger[ROOT]
10:37:00,846 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
10:37:00,846 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.springframework.core level set to WARN
10:37:00,846 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.springframework.beans level set to WARN
10:37:00,846 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.springframework.context level set to WARN
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.springframework.http level set to WARN
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.springframework.web level set to WARN
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.hibernate.SQL level set to DEBUG
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.hibernate.type level set to DEBUG
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.hibernate.stat level set to DEBUG
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.hibernate.jdbc level set to DEBUG
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
10:37:00,847 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@269c62d0 - Registering current configuration as safe fallback point
avg 19, 2015 10:37:00 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/web.server.xml]
logs from jetty starting after this line...
logback-test.xml配置:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %m%n</pattern>
</encoder>
</appender>
<appender name="QUICK_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logging.log</file>
<append>true</append>
<encoder>
<pattern>%date{ISO8601} [%-10c] [%-8t] [%C{10}.%M\(\):%L] - %m%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="QUICK_LOG" />
<appender-ref ref="STDOUT" />
</root>
<logger name="org.springframework.core">
<!--<level value="DEBUG" />-->
<level value="warn" />
</logger>
<logger name="org.springframework.beans">
<!--<level value="DEBUG" />-->
<level value="warn" />
</logger>
<logger name="org.springframework.context">
<!--<level value="DEBUG" />-->
<level value="warn" />
</logger>
<logger name="org.springframework.http">
<!--<level value="DEBUG" />-->
<level value="warn" />
</logger>
<!-- below alternate between debug and info -->
<logger name="org.springframework.web">
<!--<level value="DEBUG" />-->
<level value="warn" />
</logger>
<logger name="org.hibernate.SQL">
<level value="DEBUG" />
<!--<level value="warn" />-->
</logger>
<logger name="org.hibernate.type">
<level value="DEBUG" />
<!--<level value="warn" />-->
</logger>
<logger name="org.hibernate.stat">
<level value="DEBUG" />
<!--<level value="warn" />-->
</logger>
<logger name="org.hibernate.jdbc">
<level value="DEBUG" />
<!--<level value="warn" />-->
</logger>
</configuration>
任何提示,方向或其他任何内容都非常感谢!感谢