wood burning stoves*
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 Android Security Essentials Live Lessons this week in the Android 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: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Throwable.html#printStackTrace
surendar prabu
Ranch Hand

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

I agree. Here's the link: http://aspose.com/file-tools
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?