2015-09-25 176 views
0

我正在Eclipse中運行Tomcat 7上的Spring-mvc Web應用程序。我得到的問題是,在運行時,Eclipse控制檯顯示除Exceptions之外的所有內容。該應用程序運行平穩,STOUTS也顯示在控制檯中。儘管NPE被我強迫,但它們仍然被忽視。Eclipse控制檯沒有顯示異常

有沒有人有機會知道他們是如何被禁用的? 問候

的logback.xml

<?xml version="1.0" encoding="UTF-8"?> 
<configuration scan="true"> 
    <!-- http://logback.qos.ch/manual/configuration.html#LevelChangePropagator --> 
    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator" /> 

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> 
     <encoder> 
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 
      </pattern> 
     </encoder> 
    </appender> 

    <appender name="FILE_ALL" 
     class="ch.qos.logback.core.rolling.RollingFileAppender"> 

     <file>${catalina.base}/logs/XXX.log</file> 

     <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
      <!-- rollover daily --> 
      <fileNamePattern>${catalina.base}/logs/XXX.%d{yyyy-MM-dd}.%i.log 
      </fileNamePattern> 
      <timeBasedFileNamingAndTriggeringPolicy 
       class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> 
       <!-- or whenever the file size reaches 100MB --> 
       <maxFileSize>100MB</maxFileSize> 
      </timeBasedFileNamingAndTriggeringPolicy> 
      <!-- keep 30 days worth of history --> 
      <maxHistory>30</maxHistory> 
     </rollingPolicy> 

     <encoder> 
      <pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg%n 
      </pattern> 
     </encoder> 
    </appender> 

    <appender name="FILE_AUDIT" 
     class="ch.qos.logback.core.rolling.RollingFileAppender"> 

     <file>${catalina.base}/logs/XXX-Protokoll.log</file> 

     <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
      <!-- rollover daily --> 
      <fileNamePattern>${catalina.base}/logs/XXX-Protokoll.%d{yyyy-MM-dd}.%i.log 
      </fileNamePattern> 
      <timeBasedFileNamingAndTriggeringPolicy 
       class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> 
       <!-- or whenever the file size reaches 100MB --> 
       <maxFileSize>100MB</maxFileSize> 
      </timeBasedFileNamingAndTriggeringPolicy> 
      <!-- keep 30 days worth of history --> 
      <maxHistory>90</maxHistory> 
     </rollingPolicy> 

     <encoder> 
      <pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg%n 
      </pattern> 
     </encoder> 
    </appender> 
    <logger name="jdbc.sqlonly" level="INFO" /> 

    <logger name="AUDIT" level="INFO" additivity="false"> 
     <appender-ref ref="FILE_AUDIT" /> 
    </logger> 
    <logger name="org.springframework" level="WARN" /> 


    <root level="ERROR"> 
     <appender-ref ref="STDOUT" /> 
     <appender-ref ref="FILE_ALL" /> 
    </root> 
</configuration> 

web.xml中

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    metadata-complete="true" version="2.5"> 
    <description>EEM</description> 
    <servlet> 
     <servlet-name>Faces Servlet</servlet-name> 
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>Faces Servlet</servlet-name> 
     <url-pattern>*.xhtml</url-pattern> 
    </servlet-mapping> 
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>classpath:application-context.xml</param-value> 
    </context-param> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 
    <listener> 
     <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 
    </listener> 
    <filter> 
     <filter-name>CharacterEncodingFilter</filter-name> 
     <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
     <init-param> 
      <param-name>encoding</param-name> 
      <param-value>UTF-8</param-value> 
     </init-param> 
    </filter> 
    <filter-mapping> 
     <filter-name>CharacterEncodingFilter</filter-name> 
     <servlet-name>Faces Servlet</servlet-name> 
    </filter-mapping> 
    <filter> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <filter> 
     <filter-name>PrimeFaces FileUpload Filter</filter-name> 
     <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>PrimeFaces FileUpload Filter</filter-name> 
     <servlet-name>Faces Servlet</servlet-name> 
    </filter-mapping> 

    <!-- OpenSessionInView --> 
    <filter> 
     <filter-name>hibernateFilter</filter-name> 
     <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class> 
     <init-param> 
      <param-name>entityManagerFactoryBeanName</param-name> 
      <param-value>entityManagerFactory</param-value> 
     </init-param> 
    </filter> 
    <filter-mapping> 
     <filter-name>hibernateFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <listener> 
     <listener-class>org.apache.myfaces.orchestra.conversation.servlet.ConversationManagerSessionListener</listener-class> 
    </listener> 
    <context-param> 
     <param-name>javax.faces.PROJECT_STAGE</param-name> 
     <param-value>Production</param-value> 
    </context-param> 

    <context-param> 
     <description>Enables the ui:debug facelets tag.</description> 
     <param-name>javax.faces.FACELETS_DEVELOPMENT</param-name> 
     <param-value>false</param-value> 
    </context-param> 

    <context-param> 
     <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name> 
     <param-value>de.odysseus.el.ExpressionFactoryImpl</param-value> 
    </context-param> 

    <context-param> 
     <param-name>javax.faces.STATE_SAVING_METHOD</param-name> 
     <param-value>server</param-value> 
    </context-param> 
    <context-param> 
     <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name> 
     <param-value>true</param-value> 
    </context-param> 
    <context-param> 
     <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name> 
     <param-value>true</param-value> 
    </context-param> 
    <context-param> 
     <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name> 
     <param-value>true</param-value> 
    </context-param> 
    <context-param> 
     <param-name>org.apache.myfaces.PRETTY_HTML</param-name> 
     <param-value>true</param-value> 
    </context-param> 
    <context-param> 
     <param-name>org.apache.myfaces.AUTO_SCROLL</param-name> 
     <param-value>true</param-value> 
    </context-param> 
    <context-param> 
     <param-name>org.apache.myfaces.LOG_WEB_CONTEXT_PARAMS</param-name> 
     <param-value>false</param-value> 
    </context-param> 
    <context-param> 
     <param-name>javax.faces.FACELETS_LIBRARIES</param-name> 
     <param-value>/WEB-INF/springsecurity.taglib.xml</param-value> 
    </context-param> 
    <context-param> 
     <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> 
     <param-value>true</param-value> 
    </context-param> 
    <context-param> 
     <param-name>primefaces.THEME</param-name> 
     <param-value>smoothness</param-value> 
    </context-param> 
    <session-config> 
     <session-timeout>15</session-timeout> 
    </session-config> 
    <welcome-file-list> 
     <welcome-file>faces/face1.xhtml</welcome-file> 
    </welcome-file-list> 
</web-app> 
+0

你記錄任何日誌框架,如Log4j?如果是這樣,請在這裏粘貼配置(web.xml和log4j配置文件) – M4ver1k

+0

我有一個logback.xml 我將兩個文件添加到描述 – washbair

回答

0

您是否設置了NullPointerException斷點揣摩出它的發生?請嘗試一下。希望它能起作用。

+0

猜猜他的問題是在日誌上顯示異常。 – M4ver1k

+0

我添加了一個引發NPE的按鈕方法。在調試時,我被重定向到FastclassByCGLIB.invoke方法。但我真的不能從中得到任何有用的信息 – washbair