aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes logging runtime exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "logging runtime exceptions" Watch "logging runtime exceptions" New topic

logging runtime exceptions

M. Gagnon
Ranch Hand

Joined: Feb 18, 2004
Posts: 68
I am using a java.util.logging.Logger object to log caught exceptions with calls to its severe() method. However, my hosting service does not allow users access to the Resin logs on the server. Is there a way to configure the Logger object to log runtime exceptions automatically to my own log file?

clio katz
Ranch Hand

Joined: Apr 30, 2004
Posts: 101
i normally use log4j - where this would be easy. however it appears java logging has self-similar facilities - to (1) init some kind of io handler, (2) associate the handler with the root logger, and (3) configure the new logger

a slightly altered sun example:

NOTE: _getLogger-by-name doesn't work this smoothly in log4j:-)

M. Gagnon
Ranch Hand

Joined: Feb 18, 2004
Posts: 68
Hmmm. It seems the only way to use the Java logging API is to call the methods exclusively in your code. I have not found a way to log runtime exceptions automatically in a programmer-specified log file. If anyone knows how to do this, please let me know. In the meantime, I'll have to switch back to the logging framework put out by bitfactory.
I agree. Here's the link:
subject: logging runtime exceptions
Similar Threads
Using java.util.logging.Logger and passing the assignment
What does checled exception mean?
runtime exception help!!!
how to set up Spring to log exceptions with level ERROR
Should I log an exception before throwing it to the caller?