You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Darrell Esau <da...@gmail.com> on 2011/12/20 18:53:56 UTC

stack traces in the log become one line

Hi all,

I'm using tomcat 6.0.18.  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

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?

Thanks,
-d

Re: stack traces in the log become one line

Posted by Darrell Esau <da...@gmail.com>.
Awesome!  That's what I was looking for.  Thanks!



On Tue, Dec 20, 2011 at 1:31 PM, Rainer Jung <ra...@kippdata.de>wrote:

> On 20.12.2011 18:53, Darrell Esau wrote:
>
>> Hi all,
>>
>> I'm using tomcat 6.0.18.  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
>>
>> 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?
>>
>
> Yes :)
>
> I stumbled over a similar situation some time ago and noticed a surprising
> feature in the HotSpot JVM. By default when the just in time compiler kicks
> in Code that has thrown exceptions a couple of time will be inlined in a
> way such that the stacks will no longer be generated (performance
> optimization).
>
> If you really want to get the stacks in all cases, you can set the JVM
> start flag:
>
> -XX:-OmitStackTraceInFastThrow
>
> The default setting is -XX:+OmitStackTraceInFastThrow (note: default "+",
> but switch to "-" to always get the stacks).
>
> Have fun!
>
> Rainer
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: stack traces in the log become one line

Posted by Rainer Jung <ra...@kippdata.de>.
On 21.12.2011 08:32, André Warnier wrote:
> Christopher Schultz wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Rainer,
>>
>> On 12/20/11 4:31 PM, Rainer Jung wrote:
>>> If you really want to get the stacks in all cases, you can set the
>>> JVM start flag:
>>>
>>> -XX:-OmitStackTraceInFastThrow
>>
>> I'm astonished! Thanks for the tip, Rainer.
>
> Me too. Reading the original post, I was tempted to hasard a guess that
> the JVM was getting tired of repeating the same thing all the time..
> My my, are those things getting smart or what ?

When I first ran into this JVM "issue" I didn't believe it either!

Regards,

Rainer

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


Re: stack traces in the log become one line

Posted by André Warnier <aw...@ice-sa.com>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Rainer,
> 
> On 12/20/11 4:31 PM, Rainer Jung wrote:
>> If you really want to get the stacks in all cases, you can set the
>> JVM start flag:
>>
>> -XX:-OmitStackTraceInFastThrow
> 
> I'm astonished! Thanks for the tip, Rainer.

Me too. Reading the original post, I was tempted to hasard a guess that the JVM was 
getting tired of repeating the same thing all the time..
My my, are those things getting smart or what ?

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


Re: stack traces in the log become one line

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rainer,

On 12/20/11 4:31 PM, Rainer Jung wrote:
> If you really want to get the stacks in all cases, you can set the
> JVM start flag:
> 
> -XX:-OmitStackTraceInFastThrow

I'm astonished! Thanks for the tip, Rainer.

- -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/

iEYEARECAAYFAk7xDp4ACgkQ9CaO5/Lv0PC9DACgmNEtvPWCF38AkAox65TID8Ei
74EAn2QY+PYPW+TX+J0SwLW2BQi+dzBF
=J+CO
-----END PGP SIGNATURE-----

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


Re: stack traces in the log become one line

Posted by Rainer Jung <ra...@kippdata.de>.
On 20.12.2011 18:53, Darrell Esau wrote:
> Hi all,
>
> I'm using tomcat 6.0.18.  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
>
> 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?

Yes :)

I stumbled over a similar situation some time ago and noticed a 
surprising feature in the HotSpot JVM. By default when the just in time 
compiler kicks in Code that has thrown exceptions a couple of time will 
be inlined in a way such that the stacks will no longer be generated 
(performance optimization).

If you really want to get the stacks in all cases, you can set the JVM 
start flag:

-XX:-OmitStackTraceInFastThrow

The default setting is -XX:+OmitStackTraceInFastThrow (note: default 
"+", but switch to "-" to always get the stacks).

Have fun!

Rainer

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


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

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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