Thank you for your help Chris! I was able to get the JUL messages bridged to
SLF4J and logged in the appropriate logback managed files.
However, as a result I'm picking up a lot of "noise" from other packages. I've
turned them down using the following configuration options (see below). Can
someone tell me if there is a way to exclude them from the two appenders
without affecting higher level handlers? For example, I'd like to ignore
messages from "org.jboss.*" and let the container continue to handle its own
logging. Unfortunately, setting the "org.jboss" level to "OFF" has a
side-effect of disabling the container's logging too (server.log).
Thank you!
- D. Pegram
<logger name="javax.enterprise" level="WARN" />
<logger name="org.springframework" level="WARN" />
<logger name="javax.faces" level="INFO" />
<logger name="org.apache" level="INFO" />
<logger name="org.hibernate" level="WARN" />
<logger name="org.primefaces" level="INFO" />
<logger name="ch.qos.logback" level="WARN" />
<logger name="org.jboss" level="INFO" />
<root level="DEBUG">
<appender-ref ref="InfoFileAppender" />
<appender-ref ref="DebugFileAppender" />
</root>
From: [email protected] [mailto:[email protected]] On
Behalf Of Chris Pratt
Sent: Tuesday, November 20, 2012 5:00 PM
To: logback users list
Subject: Re: [logback-user] Logging uncaught exceptions that go to server.log
There's an extremely good probability that those statements are being written
to the java.util.logging subsystem. If you would like those bridged over to
your Logback for processing, look into the SLF4j Bridge Handler
(http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html)
(*Chris*)
On Tue, Nov 20, 2012 at 1:40 PM, Pegram, David
<[email protected]<mailto:[email protected]>> wrote:
Greetings!
I have a web app built with Maven I've added Logback to handle the logging with
two rolling file appenders. Unfortunately, some exceptions (below) still bubble
up to the server.log and are not captured in the logback generated files. How
can I capture these with logback and keep them out of server.log?
15:46:41,888 SEVERE [javax.enterprise.resource.webcontainer.jsf.context]
(http-) JSF1073: javax.faces.event.AbortProcessingException caught during
processing of PROCESS_VALIDATIONS 3 :
UIComponent-ClientId=templateForm:ddlCarrierView, Message=/foo/bar.xhtml
@144,91 valueChangeListener="#{BackingBean.method}":
java.lang.NullPointerException
15:46:41,889 SEVERE [javax.enterprise.resource.webcontainer.jsf.context]
(http-) /foo/bar.xhtml @144,91 valueChangeListener="#{BackingBean.method}":
java.lang.NullPointerException: javax.faces.event.AbortProcessingException:
/foo/bar.xhtml @144,91 valueChangeListener="#{BackingBean.method}":
java.lang.NullPointerException
at
javax.faces.event.MethodExpressionValueChangeListener.processValueChange(MethodExpressionValueChangeListener.java:157)
[jboss-jsf-api_2.1_spec-2.0.2.Final-redhat-1.jar:2.0.2.Final-redhat-1]
...
Caused by: java.lang.NullPointerException
at my.app.BackingBean.method(BackingBean.java:298) [classes:]
...
Below are the relevant configuration pieces.
Thank you for your help!
- D. Pegram
pom.xml:
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.7</version>
</dependency>
Logback.xml:
<?xml version="1.0" ?>
<configuration debug="true">
<appender class="ch.qos.logback.core.rolling.RollingFileAppender"
name="InfoFileAppender">
<append>true</append>
<file>${jboss.server.log.dir}/maApp.log</file>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${jboss.server.log.dir}/myApp.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date, %level, %logger, Account: %X{accountId}
Session: %X{sessionId} %msg %ex%n</pattern>
</encoder>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender"
name="DebugFileAppender">
<append>true</append>
<file>${jboss.server.log.dir}/myApp-debug.log</file>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${jboss.server.log.dir}/myApp-debug.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%date, %level, %thread, %logger, %class, %method,
%line: Account: %X{accountId} Session: %X{sessionId} %msg %ex%n
</pattern>
</encoder>
</appender>
<root>
<level value="debug" />
<appender-ref ref="InfoFileAppender" />
<appender-ref ref="DebugFileAppender" />
</root>
</configuration>
________________________________
The contents contained herein may contain confidential information. If you are
not the intended recipient, you are hereby notified that any disclosure,
copying, distribution, printing or action taken on the contents is strictly
prohibited. If you have received this email in error, please notify the sender
immediately and delete this message.
_______________________________________________
Logback-user mailing list
[email protected]<mailto:[email protected]>
http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user