• Post Reply Bookmark Topic Watch Topic
  • New Topic

logging runtime exceptions  RSS feed

 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks
 
clio katz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:-)


hth
 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!