My system works on a command pattern where an XML request is sent to the backend server and the server processes the request depending on the request type.
In order to debug the system and do support, I would like to put each request into its own log file using log4j and its appenders.
My question is, how would you recommend passing the logger name to the various objects in my server so that the operation logs in the right file?
For example, requestType1 comes in and uses EntityBean1. If a requestType2 is received and also uses EntityBean1, I want EntityBean1 to log to requestType1.log while processing requestType1 and requestType2.log while processing requestType2.
I thought about using the HttpSession to save the request name (which will be used to create the Logger) since the initial request is sent to a servlet, but the only way I know of getting an HttpSession is to use HttpRequest.getSession(). I obviously don't want to pass the HttpRequest everywhere. If I do that, I might as well pass the request name everywhere.
Is there a concept of a JBoss session that I could put the request name into and retrieve from my other objects?
Anyone have any other suggestions of how to handle this problem?