You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2011/12/20 19:04:19 UTC

Re: [OT] stack traces in the log become one line

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Darrell,

Marking OT since Tomcat doesn't handle any of this logging -- it's all
about System.err.

On 12/20/11 12:53 PM, Darrell Esau wrote:
> I'm using tomcat 6.0.18.

You should seriously consider upgrading.

> I've got an older app which, for logging, mostly just prints stack 
> traces to System.out.

:(

> When tomcat starts, any stack trace printed this way will print out
> fully and be visible in catalina.out

Good.

> However, after the server has been running some time, when those
> same exceptions keep getting printed, they start to become
> truncated to a single line of text, such as:
> 
> java.lang.ArrayIndexOutOfBoundsException
> 
> 
> Is there some configuration setting that I can change to make it
> continue to print out the full stack trace?

Since there is no stack trace, it's tough to tell *why* that's being
printed to the log. It's entirely possible that some code in your
webapp is actually only logging the exception type and not the stack
trace. For instance:

catch (Exception e) {
  ´System.err.println(e);
}

That just prints the message, not the stack trace. To get the stack
trace, you have to either call Exception.printStackTrace or build the
stack trace into a string and then dump it all at once using
System.err.println.

Tomcat has no configuration for this, because Tomcat doesn't do
anything with System.err (well, there is one thing it does but that's
not the problem, here). I don't believe there is any configuration in
the JVM for it, either. I think it's probably a code problem.

Happy grepping :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAk7wziMACgkQ9CaO5/Lv0PBh0wCfZoFy0/nKZ2sCTRT4SP1SyKf9
yq0AlREeUmdMPhq9JYlOuat9/M0JdTA=
=aRRw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org