[jboss-user] [EJB 3.0] New message: "Re: Application/EAR level interceptors"

Thomas Goettlich do-not-reply at jboss.com
Mon Feb 15 18:44:57 EST 2010


User development,

A new message was posted in the thread "Application/EAR level interceptors":

http://community.jboss.org/message/526475#526475

Author  : Thomas Goettlich
Profile : http://community.jboss.org/people/ThomasGo

Message:
--------------------------------------------------------------
Well,  I've faced
Ththat problem multiple times so far, but wasn't able to find a way around this yet.
 
In the current case the primary objective is to provide more logging information:
 
Since we have multiple applications that might be more or less identical (i.e. different builds for different customers) running on the same server, we want to provide information about the application that generated a log message (e.g. "[SomeClass (App: SomeApp)] message", with SomeApp being an application supplied string ).
 
Using log4j, I figured out that the best way to do this would be to inject the information into the MDC which can be read by PatternLayout.
Our application is mostly web-based and thus the first step was to add a servlet filter which sets the information at the beginning of each request and clears it afterwards.
 
However, we also have processed that aren't initated via http requests, e.g. scheduler jobs or process started via the JMX console.
We'd also like to add the extra information in those cases, without explicitly putting it into the MDC in each method that can start a process (i.e. MBean methods, job methods etc.). This approach would be tedious and error prone, so we decided an interceptor would be the best way, since each and every call to a service would be intercepted. Thus nobody could bypass/forget that step and we'd have to write our code only once.
 
There are also a bunch of other applications that might end up running on the same server and those would not be able to provide the information required by a global interceptor.
 
 
Conceptually, an application-wide interceptor could be used for other tasks that apply to all services of only one application.
IMHO, the server should not know about any specifics of the application and putting a global interceptor into the server's lib directory for just one application would contradict this.
 
 
Thanks for your help in that matter.


--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/526475#526475




More information about the jboss-user mailing list