Description:
|
In logback 1.0.4 Syslogappender got the <StackTracePattern> property, which we have been using to pass stacktraces to our logserver with a custom prefix for each line.
This has worked, but we've had a few problems that I finally had some time to look into. My goal has been to achieve a logging behaviour similar to what RollingFileAppender produces.
I've identified a type of line that does not get sent to syslog. When a stacktrace is logged, RollingFileAppender will log:
-the log line
-a special line containing IThrowableProxy.getClassName() + IThrowableProxy.getMessage()
-the lines of the stacktrace
if it is a nested stacktrace, RollingFileAppender will then proceed to log:
-a special line containing "Caused by: "+IThrowableProxy.getClassName() + IThrowableProxy.getMessage()
-the lines of the nested stacktrace
Here is an example of a stacktrace produced by RollingFileAppender:
18.09.2012 18:36:19.312 [INFO] [n.v.w.t.WSTesterServlet] [XXXXIMB.1347986179274.0]: SystemException caused by nullpointer:
no.vps.exceptions.SystemException: COM_INVALID_CHAR
at no.vps.ws.tester.WSTesterServlet.handleRequest(WSTesterServlet.java:79) [classes/:na]
at no.vps.ws.tester.WSTesterServlet.doGet(WSTesterServlet.java:54) [classes/:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718) [javax.j2ee.servlet.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) [javax.j2ee.servlet.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131) [com.ibm.ws.webcontainer.jar:na]
at no.vps.ws.web.filter.MDCFilter.doFilter(MDCFilter.java:50) [VPS_WebServicesCommonFramework-1.6.0-logtest-SNAPSHOT.jar:1.6.0-logtest-SNAPSHOT]
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) [na:CC70.CF [a0849.02]]
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) [na:CC70.CF [a0849.02]]
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604) [com.ibm.ws.runtime.jar:na]
Caused by: java.lang.NullPointerException: null
at no.vps.ws.tester.WSTesterServlet.handleRequest(WSTesterServlet.java:77) [classes/:na]
... 29 common frames omitted
In Syslogappender, the special lines do not get sent to syslog, at all. The lines are:
no.vps.exceptions.SystemException: COM_INVALID_CHAR
Caused by: java.lang.NullPointerException: null
As a result
-the exception message is not logged
-nested stacktraces are presented as one long stacktrace, making it very difficult to figure out where one stacktrace ends and the next ensted stacktrace begins.
|