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
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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.
    Bookmark Topic Watch Topic
  • New Topic