• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how to log errors occurred in backend java engine or servlet

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sometimes due to internal engine or java heap space or null pointer exception, jsp page shows the complete stack trace. So I configured the error page, registered that in web.xml through <error-page> tag. But I want those error to be logged in my designated log file or better email to me. How to do that? Please help me.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Log4J
 
Rahul P Kumar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Log4J


If I will put logger in my simpleController class, which takes action based on requested jsp, will it be enough to log stated exceptions. BTW, I've already logger configured, though exceptions caught are standard one (IOException and ServletException). Do you think, if I will use "throws NullPointerException or OutOfMemoryError", it will be logged or say catch them and log the stacktrace, it will solve the purpose. Well I've tried with NullPointerException (thrown and catched), but there was no logging in my log4J. Only logging is in tomcat logger ("localhost....") and that is every time irrespective of logger configured or not.
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic