1 Reply Latest reply on Jul 8, 2010 6:27 AM by Adrian Mitev

    is there any way to hide ViewExpiredException from logs?

    Jean Luc Apprentice

      When sessions expire, javax.faces.application.ViewExpiredException is thrown. I have an entry in pages.xml to handle that, but logs are still filled with the stack trace from Seam's Exceptions class. I would like to avoid that, it's just noise in the logs.


      I checked the source of Exceptions but logging happens anyway, no matter what the handles does.



        public void handle(Exception e) throws Exception {
            if ( Contexts.isConversationContextActive() )
            {
               Contexts.getConversationContext().set("org.jboss.seam.caughtException", e);
            }
             [...snip...]
            for (ExceptionHandler eh: exceptionHandlers) {
               //Try to handle most-nested exception before least-nested
               for (int i=causes.size()-1; i>=0; i--) {
                  Exception cause = causes.get(i);
                  if ( eh.isHandler(cause) ) {
                     if ( Contexts.isConversationContextActive() ){
                        Contexts.getConversationContext().set("org.jboss.seam.handledException", cause);
                     }
                     eh.handle(cause);
                     if (eh.isLogEnabled() && eh.getLogLevel() != null){
                        switch (eh.getLogLevel()) {
                           case fatal: 
                              log.fatal("handled and logged exception", e);
                              break;
                           case error:
                              log.error("handled and logged exception", e);
                              break;
                           case warn:
                              log.warn("handled and logged exception", e);
                              break;
                           case info:
                              log.info("handled and logged exception", e);
                              break;
                           case debug: 
                              log.debug("handled and logged exception", e);
                              break;
                           case trace:
                              log.trace("handled and logged exception", e);
                        }
                     }
                     
                     Events.instance().raiseEvent("org.jboss.seam.exceptionHandled." + cause.getClass().getName(), cause);
                     Events.instance().raiseEvent("org.jboss.seam.exceptionHandled", cause);
                     return;
                  }
               }
            }
            



      The entries in the log:


      2010-07-07 12:41:51,062 SEVERE [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.0.1-8180-1) JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: ) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@5c205b]
      
      2010-07-07 12:41:51,171 ERROR [org.jboss.seam.exception.Exceptions] (http-127.0.0.1-8180-1) handled and logged exception
      javax.servlet.ServletException: viewId:/account/account_view.seam - View /account/account_view.seam could not be restored.
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:530)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
              at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.faces.application.ViewExpiredException: viewId:/account/account_view.seam- View /account/account_view.seam could not be restored.
              at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:185)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:103)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)