• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to capture java.lang.Error in log files

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a standalone java enviornment with robust exception handling and the application is well tested.

But some times the process flow is not behaving the way it is expected.
Thus I would want to keep track of anything abnormal that might be happening by looking at the log files. I am thinking that log4j configuration might not help me to log the occurence of the java.lang.Error subclasses.

Similar to the .out files in weblogic enviornment which logs everything that happens in the JVM including the occurence of any java.lang.Error (like stackoverflow/outofmemoryerror), is there a way to capture such errors when occured in a standalone/non-J2EE enviornment?

Any help is appreciated.

Thanks in advance for your time and input.

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am thinking that log4j configuration might not help me to log the occurence of the java.lang.Error subclasses.


Why ? log4j can log any java.lang.Throwable, java.lang.Error included.

is there a way to capture such errors when occured in a standalone/non-J2EE enviornment?


If you catch them at your program's entry point, yes. These are usually unrecoverable errors though, so even if you log the error, it might not be a good idea to continue as if nothing happened.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic