I would like to print a stack trace for the exception that was found in the pages.xml file, but I want to do this only if the most granular level of logging is more granular than warn. So testers can copy / paste the stack trace, but end users never see it.
Environmental Information:
Here's how exceptions are handled ...
From pages.xml:
<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">
<exception class="javax.faces.application.ViewExpiredException">
<end-conversation />
<redirect view-id="/exceptionSessionTimeout.xhtml" />
</exception>
<exception>
<end-conversation />
<redirect view-id="/exception.xhtml" />
</exception>
</pages>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/unhandledException.html</location>
</error-page>
</web-app>
logback.xml:
<?xml version="1.0" encoding="UTR-8"?>
<configuration scan="true">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%date] [%thread] [%level] [%mdc] [%logger:%method:%line]: %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/path/to/app-logs-dir/AppName.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/path/to/app-logs-dir/AppName.%d{yyyy-MM-dd-a}.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>[%date] [%thread] [%level] [%mdc] [%logger:%method:%line]: %msg%n</pattern>
</encoder>
</appender>
<logger name="com.example" level="trace" />
<logger name="com.example.auth" level="error" />
<root level="warn">
<appender-ref ref="FILE" />
<appender-ref ref="CONSOLE" />
</root>
</configuration>
, /error.xhtml(from pages.xml):
<logger name="com.example" level="trace" />
:
<logger name="com.example" level="warn" />
Facelets Seam, ?