aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Is there a way to handle logging of exceptions. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Is there a way to handle logging of exceptions." Watch "Is there a way to handle logging of exceptions." New topic
Author

Is there a way to handle logging of exceptions.

ram kumar
Ranch Hand

Joined: May 22, 2008
Posts: 146
for instance,

i have 5 java classes all these has try catch block in it.

when an exception happens ... that exception has to be logged in the logs.

BUT WE WILL NOT PUT EVEN A SINGLE LINE OF CODE IN THE 5 CLASSES.

SOME OTHER CLASS SAY, CLASS 6 HAS TO DO THIS MONITORING ALL OTHER 5 CLASSES FOR EXCEPTIONS.

IS THIS POSSIBLE / OR IS THERE ANY OTHER WAY TO DO THAT.


Discussion - the powerfull way to excellence!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Ram ranch",
Please check your private messages regarding an important administrative matter.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61432
    
  67

And please do not post in all uppercase characters.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Ram ranch",
Please check your private messages regarding an important administrative matter.
-Ben
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Ram J",
Please check your private messages regarding an important administrative matter.
-Ben
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"java spring",
Please check your private messages.
-Ben
Arun Natarajan
Ranch Hand

Joined: Jul 21, 2006
Posts: 30
Sounds like what you are looking for is aspect oriented programming. AspectJ is one implementation that you could try.
Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
Hi Arun,
I have also heard some how that it can be achieved by AOP. Moreover, I am very curious to achieve the same functionality of logging in my application.But I don't know how to write it, as I have never used AOP.
Can you please point some URL where I can get beginner level examples of AOP.

thanks in advance !!
[ June 18, 2008: Message edited by: Ramesh Kumar Swarnkar ]
Arun Natarajan
Ranch Hand

Joined: Jul 21, 2006
Posts: 30
You can look at this URL for one of the several available implementation of AOP.
http://www.eclipse.org/aspectj/doc/released/progguide/index.html
Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
Thank you very much Arun for this link.


regards,
Ramesh
 
Consider Paul's rocket mass heater.
 
subject: Is there a way to handle logging of exceptions.