Thanks for the response. I had looked into the NDC approach, and it would have been perfect for this scenario except for the fact that I need to be able to override the log level/threshold on a by-user basis and, in log4j, that seems to require a seperate Logger instance.
So basically, in the User bean initialization I do the following: Logger logger = Logger.getLogger( "session." + user + "_" + session ); Level userLevel = LogLevelOverride.getLevelFor( user ); // LogLevelOverride is my own custom helper class if (userLevel != null) logger.setLevel( userLevel ); There is not I way I could see to do this using the NDC approach. Plus the fact that I am logging to JMS and NDC does not appear to be a serializable portion of the logging event. ----- Original Message ----- From: "Mike Brodhead" <[EMAIL PROTECTED]> To: "Log4J Users List" <[EMAIL PROTECTED]> Sent: Wednesday, December 26, 2001 4:58 PM Subject: Re: freeing up categories/loggers > > > > In parts of our application, we are using log4j Logger objects in a > > non-static context. We have a user class, which gets a Logger based upon > > the user id this User object represents as well as the HttpSession to which > > this user belongs: > > Logger logger = Logger.getLogger( "session." + user + "." + session ); > > > > However, my understanding is that log4j will keep a reference to this > > specific logger in case it can get used again. But, because this logger is > > so unique and there is a high probability that a logger with this exact name > > will never again be used, is there a way to tell log4j to close this logger? > > This is not a direct answer to your question, but you might consider > putting the session information into a Nested Diagnostic Context > rather than using a separate logger for each user session. > > I haven't tackled that yet with my app, but it seems like the sensible > way to go. NDCs are designed to be ephemeral. > > --mkb > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>