This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Websphere and the fly likes exception to log file 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 » Products » Websphere
Bookmark "exception to log file" Watch "exception to log file" New topic
Author

exception to log file

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
Hi need to stack trace of java exception to log file .how it can done.
simple messages i am able to send in log file but how to send complete stack trace of exception
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

You need a stack trace?

exception.printStackTrace() should print the stacktrace to the System.out log. Is this not adequate? exception.getClass() exception.getMessage() and exception.printStackTrace() should do it.

I have a feeling you were looking for something a little more in depth. Let me know.

-Cameron McKenzie
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

Hi need to stack trace of java exception to log file


Assuming you are using log4j, log4j has overloaded methods to which you can pass the entire exception object and it will print the exception stacktrace in the appropriate log file. Something like:



[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exception to log file
 
Similar Threads
java.lang.ExceptionInInitializerError
Unable to print stack trace on own log file
tomcat is not starting
exception stack trace not going to log file
Struts - JAXB problem