This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes BEA/Weblogic and the fly likes Access HttpSession from static methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Access HttpSession from static methods" Watch "Access HttpSession from static methods" New topic
Author

Access HttpSession from static methods

chris macneel
Greenhorn

Joined: Dec 18, 2002
Posts: 1
I support a Web application written on the Weblogic 6.1 platform. All logging is issued via a log4j wrapper class called Logger. This class has several static methods (debug, info, warning, etc.) that call into log4j Category methods.
As these methods are static, they're being called from many different sources (servlets, filters, beans) without instantiating the Logger class.
I would like to pull specific user information from the HttpSession (home-grown authentication using public name) and append this to the logged message, but the Logger class static methods do not have direct access to the HttpSession.
Also, at any one point in time, I don't know whether these static methods are participating in a session.
My question: Is there an appropriate way to create a stateful session bean, populate with user info and later retrieve the bean from Logger to pull the info? Where's the best place to instantiate the session bean?
Thanks!
Chris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access HttpSession from static methods
 
Similar Threads
Servlet Logging
SSB as a Log4J logger?
per-session instance of servlet?
how to deal with session if you have both servlet and EJB ?
How to manage the session for GUI and Web client