I don't think I've heard of anyone defining a repository selector that had two distinct criteria for choosing the logger repository. Only one selector can be installed at any given time. How would Log4j know which logger repository to choose? The two standard choices are by an App's JNDI tree and by classloader. The latter is problematic and can cause classloader issues. The former is what has been adopted as a standard solution in Log4j-1.3. If you come up with a technique for choosing multiple logger repositories per/app, I'd be very interested to see it. I can't think of how it might be implemented, though.
I still think using a filter one or more appenders within a single logger repository is a viable option. That's where I would focus my efforts if I were to implement what you are proposing. Jake Quoting "Olofsson, Magnus" <[EMAIL PROTECTED]>: > Thanks for your reply. > > Indeed, a separate logging repository for each session would be a > nightmare. I was more thinking about having two logging repositories, > one for normal case of logging and one for debug logging. Then I would > be getting all sessions with debug=true in the same repository and > consequently the logs for those sessions would be mixed, but that would > be much less than 300 sessions logging at debug level at the same time. > > Another alternative would be to set the threshold of each Logger > instance depending on if debug level is required or not. > > /Magnus > > -----Original Message----- > From: Jacob Kjome [mailto:[EMAIL PROTECTED] > Sent: den 25 april 2006 05:55 > To: Log4J Users List > Subject: Re: Logging of specific session in web app. > > > Well, the repository selector would require access to each session > object. Even if you could do this, I wouldn't recommend it. 300 or > more separate logger repositories seems to me like runtime bloat you > don't want. > > I wonder if you could write a filter for an appender which could be > configurable at runtime to allow logging for specific users. I haven't > tried it, but it seems like a much better approach than a logger > repository per user. > > Jake > > At 04:19 AM 4/24/2006, you wrote: > >Hi. > > > >Is it possible to control the logging level for a specific session of > a >web application? > > > >Scenario: > >I have a Tomcat server hosting a number of web applications. One of > the >web application is usually handling 300 simultaneously active > sessions > >(users) at peak times. Needless to say it is not very practical to > have >a log threshold lower than ERROR or possibly WARN. However, at > times I >feel that it would be convenient to be able to enable logging > for a >specific session only. For instance one of the users experience > a >problem which is not there for the other users. Could be user > profile >related, data related or have something to do with what the > user has >done in the past in the same session. If I try to reproduce > the problem >in a test environment there is a risk that the exact steps > leading to >the error is not followed. In my experience users very > seldom remember >what steps they took to get to a specific point in the > application. > > > >I have read Ceki's excellent article "Supporting the log4j > >RepositorySelector in Servlet Containers" on separating logging per > >context using the RepositorySelector. Could this approach be used to > >have separate loggers for different session? > > Magnus > > > > > >Magnus Olofsson > >EDS Sweden AB - Nordic Solution Centre >Kajskjul 107 A, Frihamnen > >SE - 417 07 Gothenburg >Sweden > > >Phone: +46 31 758 90 99 > >Mobile: +46 702 45 29 24 > >Fax: +46 31 758 90 01 > >Email: mailto:[EMAIL PROTECTED] > > > >This email contains information which is confidential and may be > >privileged. Unless you are the intended addressee (or authorised to > >receive for the addressee) you may not use, forward, copy or disclose > to >anyone this email or any information contained in this email. If > you >have received this email in error, please advise the sender by > reply >email immediately and delete this email. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
