Grouping of errors printed by printStackTrace() in system errors logs Statistics

38 views
Skip to first unread message

Tp Chan

unread,
May 9, 2017, 2:33:43 AM5/9/17
to javamelody
In the system errors logs Statistics in Java Melody, if errors are generated by Java, the error messages can be grouped as one entry:

For example:

ERROR [javax.enterprise.resource.webcontainer.jsf.context] javax.faces.application.ViewExpiredException: viewId:/pages/secure/parameter/tuitionFee/tuitionFee.xhtml - View /pages/secure/parameter/tuitionFee/tuitionFee.xhtml could not be restored.
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:205)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:219)
.....

The above occupies only 1 line in the error stats.

However, if the error is printed by printStackTrace(), one line of the error occupy one line of the statistics, e.g.

ERROR [stderr] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
54
ERROR [stderr] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
39
ERROR [stderr] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
18
ERROR [stderr] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
15
ERROR [stderr] at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
12
ERROR [stderr] at java.lang.reflect.Method.invoke(Method.java:606)
10
ERROR [stderr] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10
ERROR [stderr] at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
6

Is there any ways to group them back as one entry in the error statistics?    As only the last 100 errors are displayed, one error will occupy all the statistics being displayed.

Thank you.
 

Emeric Vernat

unread,
May 10, 2017, 9:37:39 AM5/10/17
to javamelody
Hi,

It seems that jboss is redirecting stderr output to jboss logs, but it does that line by line.

In order that exceptions printStackTrace() are not logged line by line, I suggest that:
- either you don't use printStackTrace() anymore and use a logger instead if you can,
- or you configure jboss so that it does not redirect stderr output anymore. See for example: http://stackoverflow.com/questions/28878736/controlling-stderr-and-stdout-output-in-wildfly

bye,
Emeric
Reply all
Reply to author
Forward
0 new messages