This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to PrintStackTrace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to PrintStackTrace" Watch "How to PrintStackTrace" New topic

How to PrintStackTrace

surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
In my application i am writing a log into a file. If there is any exception thrown how can i print the stack trace into the file? I am not able to do this using the printstacktrace method over the exception object thrown.
I am only able to print the exception message but not the complte stack trace. Please help me.


SCJP 1.4
Ajay Singh
Ranch Hand

Joined: Dec 13, 2006
Posts: 182
It should be something like:

see the printStackTrace doc:
surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
Thank U very much Ajay.

I agree. Here's the link:
subject: How to PrintStackTrace
Similar Threads
exception to log file
Exception Interceptor Throws Advice
WAS 5.0 - Exception Stack Trace not printed in log file
Can anyone explain this to me?