aspose file tools
The moose likes Websphere and the fly likes exception to log file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Websphere
Reply 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: 4967

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


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8141
    
  52

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: jrebel
 
subject: exception to log file
 
Similar Threads
java.lang.ExceptionInInitializerError
exception stack trace not going to log file
Struts - JAXB problem
Unable to print stack trace on own log file
tomcat is not starting