You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Godmar Back <go...@gmail.com> on 2010/02/11 06:08:18 UTC
Q: how to prevent log4j from cutting off stack traces?
Hi,
I'm trying to find out how to configure log4j to not cut off crucial
parts of stack traces.
Here is an example from my Apache Tomcat log:
>>com.thoughtworks.xstream.mapper.CannotResolveClassException: WallPosting : WallPosting
>> at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:68)
>> at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
>> at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:71)
>> at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
>> at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)
>>...
In order to debug this problem, I need to see the full stack trace,
but I can't find how to configure log4j accordingly.
All I've found so far are users similarly confused as I am (*)
I'm not even sure if log4j is the culprit or not.
Thanks!
- Godmar
Google keywords: log4j, stacktrace, stack trace, truncation,
truncated, cut off, ellipsis, short stack trace
(*) http://www.velocityreviews.com/forums/t147237-log4j-stack-trace-depth.html
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Q: how to prevent log4j from cutting off stack traces?
Posted by Godmar Back <go...@gmail.com>.
Thank you for the help.
After grepping through the log4j code, I downloaded Apache juli, then
all logging classes in Tomcat, without success in finding the issue.
That left only the web application - I finally found the problem was
with the ZK (zkoss.org) framework (*), which renders the stack trace
to a string before passing it on to the logger. They cut it off at
depth 6 in certain cases.
Unfortunately, it's not possible to tell from the log whether the
stacktrace was rendered by the logging framework or not. (That may
actually a suggestion for improvement: provide a formatting mode that
clearly distinguishes strings from stack traces rendered by the
logger, for instance, by prefixing each line of a string with a
certain marker.)
- Godmar
(*) http://www.zkoss.org/javadoc/3.6/zk/org/zkoss/lang/Exceptions.html#getBriefStackTrace%28java.lang.Throwable%29
On Fri, Feb 12, 2010 at 12:16 AM, Curt Arnold <ca...@apache.org> wrote:
> Unless the user has configured otherwise, log4j just outputs the results of Exception.printStackTrace(Writer). Any truncation occurs within the implementation of printStackTrace, likely way back in the JVM and could be controlled by any configuration supported by the JVM. However, I was not able to find any command line arguments or similar to tweak that behavior.
>
> In the SVN HEAD, the throwable renderer is configurable and EnhancedThrowableRenderer uses Exception.getStackTrace instead which may not be affected by stack trace truncation.
>
>
>
> log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
>
> or
>
> <throwableRenderer class="org.apache.log4j.EnhancedThrowableRenderer"/>
>
> to log4j.properties or log4j.xml respectively.
>
> See http://issues.apache.org/bugzilla/show_bug.cgi?id=45721 for the backstory.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Q: how to prevent log4j from cutting off stack traces?
Posted by Curt Arnold <ca...@apache.org>.
Unless the user has configured otherwise, log4j just outputs the results of Exception.printStackTrace(Writer). Any truncation occurs within the implementation of printStackTrace, likely way back in the JVM and could be controlled by any configuration supported by the JVM. However, I was not able to find any command line arguments or similar to tweak that behavior.
In the SVN HEAD, the throwable renderer is configurable and EnhancedThrowableRenderer uses Exception.getStackTrace instead which may not be affected by stack trace truncation.
log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
or
<throwableRenderer class="org.apache.log4j.EnhancedThrowableRenderer"/>
to log4j.properties or log4j.xml respectively.
See http://issues.apache.org/bugzilla/show_bug.cgi?id=45721 for the backstory.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Q: how to prevent log4j from cutting off stack traces?
Posted by Godmar Back <go...@gmail.com>.
On Thu, Feb 11, 2010 at 11:45 AM, Jacob Kjome <ho...@visi.com> wrote:
> I don't recall ever seeing Log4j cut off stack traces. In fact, the reason
> the FilteredPatternLayout [1] was invented was because stack traces
> contained too much detail, not too little.
>
> Unless someone else can confirm that Log4j is the culprit, I would look
> elsewhere to find who/what might be cutting off stack frames.
Thanks, I appreciate your answer. Like I said, I too wasn't sure if
log4j was the culprit. I grepped through the log4j (ThrowableInfo) and
didn't see a cutting off anywhere.
I'm now starting to wonder if I'm using log4j at all, rather than JULI
(discussed here: http://tomcat.apache.org/tomcat-6.0-doc/logging.html
).
- Godmar
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Q: how to prevent log4j from cutting off stack traces?
Posted by Jacob Kjome <ho...@visi.com>.
I don't recall ever seeing Log4j cut off stack traces. In fact, the reason
the FilteredPatternLayout [1] was invented was because stack traces contained
too much detail, not too little.
Unless someone else can confirm that Log4j is the culprit, I would look
elsewhere to find who/what might be cutting off stack frames.
[1] http://openutils.sourceforge.net/openutils-log4j/filteredlayout.html
Jake
On Thu, 11 Feb 2010 00:08:18 -0500
Godmar Back <go...@gmail.com> wrote:
> Hi,
>
> I'm trying to find out how to configure log4j to not cut off crucial
> parts of stack traces.
> Here is an example from my Apache Tomcat log:
>
>>>com.thoughtworks.xstream.mapper.CannotResolveClassException: WallPosting :
>>>WallPosting
>>> at
>>>com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:68)
>>> at
>>>com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
>>> at
>>>com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:71)
>>> at
>>>com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
>>> at
>>>com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)
>>>...
>
> In order to debug this problem, I need to see the full stack trace,
> but I can't find how to configure log4j accordingly.
>
> All I've found so far are users similarly confused as I am (*)
>
> I'm not even sure if log4j is the culprit or not.
>
> Thanks!
>
> - Godmar
>
> Google keywords: log4j, stacktrace, stack trace, truncation,
> truncated, cut off, ellipsis, short stack trace
> (*)
>http://www.velocityreviews.com/forums/t147237-log4j-stack-trace-depth.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org