I do this exact same thing through JMS logging. I have a User object which acquires a per-instance Logger by doing : Logger.getLogger( "session." + getUserName() ).
In my config I then have an explicit entry for session which pushes out to the appropriate JMS destination. There is then a message-driven EJB listening on that destination which "decodes" the username from the LoggingEvent and pushes to the appropriate file. Of course, as you mention that is pretty coding intensive (relative to some config file driven solution). The other options I thought of were as foloows: 1) Add explicit entries into your config file for each and every user. Of course this requires that you know in advance all the users of your system. Of course you could add in logic to the UseCase of adding a user to the system to generate a new entry into the log4j config file, but that in-and-of-itself is pretty code intensive. 2) If your users are stored in LDAP or a database or some other easily accessible format, you can try a manual configuration of log4j for these users in a startup class. This would basically be defining loggers, appenders, etc on the fly. 3) A custom appender subclassing FileAppender which knows how to "discriminate" the final target file based on the category name of the event. The file defined in the config would be a base directory and the appender would simply manage output to seperate files in that directory. Just some more ideas. HTH ******************************************** Steve Ebersole IT Integration Engineer Vignette Corporation 512.741.4195 Visit http://www.vignette.com ******************************************** -----Original Message----- From: Saif Khaja [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 1:51 PM To: [EMAIL PROTECTED] Subject: creating log file for each user We have our application running on Websphere with log4j 1.1.3. It involves some complicated calculations for each transaction that user performs. Every thing goes on fine except that since there is just one common log file, these calculations log statments get intermingled among different users making it hard to debug an issue. What I was trying to achieve is a way to create a log file for each user. This way, all complex calculations log statements will be separate for each user making it easier to debug if we have to. I did spend quite a while going thru the archives on this issue but couldnt find one. So if this has been discussed already, I apologize for it. Among the existing appenders/patterns in log4j, I could use the following to achieve the same thing: 1. jdbcappender: send the log statements to the database and can query them on each user. This would however take too much database space. 2. jmsappender: I havent really looked closely at this one yet. But I know I could receive the log statements and write some custom code to put each log statement in a separate file based on the user who initiated it. 3. xmllayout: Generate xml version of the log file and write xsl to display the log file for requested user. I was wondering if there is a quicker/cleaner way or am I just complicating things for myself to achieve this. And if there is none, is there something that is planned in near future. Thanks, Saif. _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- 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]>