• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

How to supress Runtime Exceptions

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

In hibernate, when the object is not found, then it throws a Runtime exception which is not needed for me. How can we stop logging the RuntimeException alone.

Thanks,
Venkat
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
change the log level.
 
Venkat Raman Parasuraman
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you please tell me how?? I mean example..Please
 
M K Rayapudi
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might be configuring logging tool using a properties file.
For e.g. Log4j.properties
in that properties file change log level to fatal where ever you find debug/info/warn/error

Note: By changing the log level to fatal may suppress other messages also


 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have clean running code that doesn't cause Exceptions. ;)

Mark
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Catch Hibernate exceptions in the service layer and re-throw them as application-specific exceptions.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what you mean by "stop logging", you mean you don't want ObjectNotFoundException to appear in log or something else? If so why do you want to do that?
 
Venkat Raman Parasuraman
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. I dont want ObjectNotFoundException in the AOP log file. It must be suppressed not being written anywhere
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Venkat Raman Parasuraman wrote:Yes. I dont want ObjectNotFoundException in the AOP log file. It must be suppressed not being written anywhere


Actually, it's good to have ObjectNotFoundException (or any exceptions) appears in the log file.
But if you really don't want...

I don't know how do you implement this AOP logging, but when an exception is thrown eventually some code will catch it, right? I imagine that the code (AOP or not) that catches it will log this exception, so can you add code to check that if type of the exception is ObjectNotFoundException then not log it?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic