Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Access HttpSession from static methods  RSS feed

chris macneel
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!