File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Spring AOP for Logging | How to write predefined custom error codes to the log file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply locked New topic
Author

Spring AOP for Logging | How to write predefined custom error codes to the log file

Prince Manchanda
Ranch Hand

Joined: Jun 25, 2001
Posts: 47
Hi All,

I am using Spring AOP for logging purpose in my application. I am using the ThrowsAdvice interface and implementing the afterThrowing(Method m, Object[] args, Object target, Throwable ex) method to invoke my wrapper log4j class.

However, I have one another requirement. For each of the exception thrown I need to log a predefined custom error code to the log file. There will be a unique error code for each type of exception scenerio.

Is there any way that I can pass this custom error code from my class to the Advice (implmenting the ThrowsAdvice interface)? If AOP supports this, then it would be a clean approach.

Thanks and Regards
P Manchanda
Prasath Premkumar
Ranch Hand

Joined: Nov 13, 2008
Posts: 43

Hi Prince,

I'm having the same problem with logging custom log messages in each exception occur. Did you find a solution for this problem?

Thanks in advance.
johnny chase
Greenhorn

Joined: May 24, 2013
Posts: 1
Hello All,
I know this is an old post but i'm in a similar situation. Does anyone have the solution?
Thanks.
 
Don't get me started about those stupid light bulbs.
 
subject: Spring AOP for Logging | How to write predefined custom error codes to the log file
 
Similar Threads
unable to call AOP method
Logging Implementation using Spring AOP or AspectJ
AOP
What is AOP?
Problem with Spring AOP