RE: Globally MDC.put/remove for hole web application
Servlet filters are first available with Servlet API 2.3. I need a solution for Servlet API 2.2. Any idea? Thanks. Stefan At 15:53 23.04.2004, you wrote: Servlet filters work just fine for this sort of thing. -Original Message- From: James Stauffer [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 9:28 AM To: 'Log4J Users List' Subject: RE: Globally MDC.put/remove for hole web application You could probably do it with a servlet filter. James Stauffer -Original Message- From: Stefan Preuss [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 1:35 AM To: [EMAIL PROTECTED] Subject: Globally MDC.put/remove for hole web application Hi, is it possible to set/remove properties on MDC globally for the hole web application (for every client request) instead of doing it in every JSP and Servlet? Thanks. Stefan - 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] ___ Stefan Preuss PROSTEP GIDA GmbH Albert-Einstein-Str. 16 D-12489 Berlin Email: [EMAIL PROTECTED] ___ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MDC cleanup - or other way for session logging
At 09:58 AM 4/20/2004, Stefan Preuss wrote: Helo, I'm developing an Web application based on JSP/Servlet/Bean. Up to now I'm using my own logger(s). Now I want to take advantage of log4j. For some simple java tools I changed before, log4j works fine. But in this case I have some trouble with the logging on server side. The application uses a session concept. The user starts with a login page (a servlet) which do some initial stuff. Then, when she entered her name and password the request is send to the menu (JSP) which uses a session bean what does the login. Now she starts working on many JSPs and servlets... finally the logout page (servlet) is called to cleanup all beans and remove them from session context. So, that's what it does. Now what I want to do: The login page does not know any about the user who is visiting it (and don't need to). All logging requests until the session bean successfully left the login should be directed to one file. So it is quiet easy to analyze the login process. To keep apart multiple requests at the same time from different clients, the HTTP session id should be logged. All user action between login and logout are to be directed to a separate file (one for each user and each session). The bulk of files are structured by creating sub directories for each user. My attempt was to use MDC to put some properties (HTTP session id and user id) on the thread that executes the current request. I wrote my own appender that holds a hash table with file appenders associated by combination of session and user id. Depending on the mentioned properties my appender gets the file appender from the hash and redirects the logging event to it. All was fine until I noticed that the servlet container (I was using tomact 3.3.1a - but WebLogic, WebSphere and JBoss has to be supported too) reuses the threads. Due to the fact that I didn't remove the user id from the thread after the request finished, the request of another client which has not yet logged in uses the same thread and logs with the wrong user id. Now I guess, if I want to use MDC for this issue I have to put and remove the properties (session and user id) in each and every JSP and servlet (about three dozens)? Is there now simpler way? I think this is some error-prone, if I forget to remove the properties... I already thought about javax.servlet.Filter, but this is first available since Servelt API 2.3. I have to support 2.2. Another thought was to have my own Filter by implementing a servlet which proxies all request and do the MDC.put and MDC.remove at its request handling... But isn't this somewhat disproportionate - just for logging ??? Filters can provide a robust solution. In general, any interception mechanism that allows you to set the MDC when starting to serve an incoming request and clearing the MDC when done serving, should do the job. Struts plug-ins, JBoss interceptors, or Tomcat valves would do the job although I'd just stick with filters... I hope that I was doing the wrong way so far, and anyone out there has an ingenious idea to do session logging with log4j. Otherwise it is really hard to do this with log4j, I think. It's more of an interception problem rather then a log4j issue. Wouldn't you think? Thanks and best regards Stefan ___ Stefan Preuss PROSTEP GIDA GmbH Albert-Einstein-Str. 16 D-12489 Berlin Email: [EMAIL PROTECTED] ___ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MDC cleanup - or other way for session logging
At 09:58 AM 4/20/2004, you wrote: Helo, [snip] The application uses a session concept. The user starts with a login page (a servlet) which do some initial stuff. Then, when she entered her name and password the request is send to the menu (JSP) which uses a session bean what does the login. Now she starts working on many JSPs and servlets... finally the logout page (servlet) is called to cleanup all beans and remove them from session context. So, that's what it does. Now what I want to do: The login page does not know any about the user who is visiting it (and don't need to). All logging requests until the session bean successfully left the login should be directed to one file. So it is quiet easy to analyze the login process. To keep apart multiple requests at the same time from different clients, the HTTP session id should be logged. All user action between login and logout are to be directed to a separate file (one for each user and each session). The bulk of files are structured by creating sub directories for each user. My attempt was to use MDC to put some properties (HTTP session id and user id) on the thread that executes the current request. I wrote my own appender that holds a hash table with file appenders associated by combination of session and user id. Depending on the mentioned properties my appender gets the file appender from the hash and redirects the logging event to it. All was fine until I noticed that the servlet container (I was using tomact 3.3.1a - but WebLogic, WebSphere and JBoss has to be supported too) reuses the threads. Due to the fact that I didn't remove the user id from the thread after the request finished, the request of another client which has not yet logged in uses the same thread and logs with the wrong user id. Now I guess, if I want to use MDC for this issue I have to put and remove the properties (session and user id) in each and every JSP and servlet (about three dozens)? Is there now simpler way? I think this is some error-prone, if I forget to remove the properties... I already thought about javax.servlet.Filter, but this is first available since Servelt API 2.3. I have to support 2.2. Another thought was to have my own Filter by implementing a servlet which proxies all request and do the MDC.put and MDC.remove at its request handling... But isn't this somewhat disproportionate - just for logging ??? Filters are a good bet. Basically any interceptor that is invoked before the servlet begins handling an incoming request and is also invoked when the servlet completes its work, is appropriate. If filters are not available, any interception mechanism can do just as well. Tomcat valves, JBoss interceptors, Struts plug-ins are all possible candidates. I hope that I was doing the wrong way so far, and anyone out there has an ingenious idea to do session logging with log4j. Otherwise it is really hard to do this with log4j, I think. It's not really a log4j problem but rather one of request interception. Thanks and best regards Stefan -- Ceki Gülcü For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MDC cleanup - or other way for session logging
At 21:02 23.04.2004, Ceki Gülcü wrote: At 09:58 AM 4/20/2004, Stefan Preuss wrote: Helo, I'm developing an Web application based on JSP/Servlet/Bean. Up to now I'm using my own logger(s). Now I want to take advantage of log4j. For some simple java tools I changed before, log4j works fine. But in this case I have some trouble with the logging on server side. The application uses a session concept. The user starts with a login page (a servlet) which do some initial stuff. Then, when she entered her name and password the request is send to the menu (JSP) which uses a session bean what does the login. Now she starts working on many JSPs and servlets... finally the logout page (servlet) is called to cleanup all beans and remove them from session context. So, that's what it does. Now what I want to do: The login page does not know any about the user who is visiting it (and don't need to). All logging requests until the session bean successfully left the login should be directed to one file. So it is quiet easy to analyze the login process. To keep apart multiple requests at the same time from different clients, the HTTP session id should be logged. All user action between login and logout are to be directed to a separate file (one for each user and each session). The bulk of files are structured by creating sub directories for each user. My attempt was to use MDC to put some properties (HTTP session id and user id) on the thread that executes the current request. I wrote my own appender that holds a hash table with file appenders associated by combination of session and user id. Depending on the mentioned properties my appender gets the file appender from the hash and redirects the logging event to it. All was fine until I noticed that the servlet container (I was using tomact 3.3.1a - but WebLogic, WebSphere and JBoss has to be supported too) reuses the threads. Due to the fact that I didn't remove the user id from the thread after the request finished, the request of another client which has not yet logged in uses the same thread and logs with the wrong user id. Now I guess, if I want to use MDC for this issue I have to put and remove the properties (session and user id) in each and every JSP and servlet (about three dozens)? Is there now simpler way? I think this is some error-prone, if I forget to remove the properties... I already thought about javax.servlet.Filter, but this is first available since Servelt API 2.3. I have to support 2.2. Another thought was to have my own Filter by implementing a servlet which proxies all request and do the MDC.put and MDC.remove at its request handling... But isn't this somewhat disproportionate - just for logging ??? Filters can provide a robust solution. In general, any interception mechanism that allows you to set the MDC when starting to serve an incoming request and clearing the MDC when done serving, should do the job. Struts plug-ins, JBoss interceptors, or Tomcat valves would do the job although I'd just stick with filters... Well, as mentioned, I already thought about filters, but they are not available for Servlet API 2.2 (Tomcat 3, WebLogic 5, ...). I hope that I was doing the wrong way so far, and anyone out there has an ingenious idea to do session logging with log4j. Otherwise it is really hard to do this with log4j, I think. It's more of an interception problem rather then a log4j issue. Wouldn't you think? That's right. I will take a look for JBoss interceptors and Tomcat valves, but I don't like the thought to use vendor specific stuff. Thanks and best regards Stefan ___ Stefan Preuss PROSTEP GIDA GmbH Albert-Einstein-Str. 16 D-12489 Berlin Email: [EMAIL PROTECTED] ___ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Thanks. Stefan ___ Stefan Preuss PROSTEP GIDA GmbH Albert-Einstein-Str. 16 D-12489 Berlin Email: [EMAIL PROTECTED] ___ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Chainsaw v2 - where is QuickRefence and Tutorial?
Hi all i just downloaded and compiled chainsaw. looks fine but i cant find the QuickRefence and Tutorial viewable from within the GUI (as promissed on the home page) where can i find it ? thx EOF Bost PS: of course i learn in trial-error method but recently i realised the RTFM method works faster :) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Chainsaw v2 - where is QuickRefence and Tutorial?
When you first startup up Chainsaw v2 you are shown the Welcome tab. Within that tab, it has it's own mini-toolbar with a Tutorial button. You can also get access to the Tutorial through the Help menu cheers, (You did download Chainsaw v2, right?) Paul Smith -Original Message- From: Rostislav Svoboda To: [EMAIL PROTECTED] Sent: 4/26/04 8:13 PM Subject: Chainsaw v2 - where is QuickRefence and Tutorial? Hi all i just downloaded and compiled chainsaw. looks fine but i cant find the QuickRefence and Tutorial viewable from within the GUI (as promissed on the home page) where can i find it ? thx EOF Bost PS: of course i learn in trial-error method but recently i realised the RTFM method works faster :) - 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]
RE: Globally MDC.put/remove for hole web application
We have a base servlet that all other servlets extend and so we do that kind of think in that servlet. James Stauffer -Original Message- From: Stefan Preuss [mailto:[EMAIL PROTECTED] Sent: Monday, April 26, 2004 1:08 AM To: Log4J Users List Subject: RE: Globally MDC.put/remove for hole web application Servlet filters are first available with Servlet API 2.3. I need a solution for Servlet API 2.2. Any idea? Thanks. Stefan At 15:53 23.04.2004, you wrote: Servlet filters work just fine for this sort of thing. -Original Message- From: James Stauffer [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 9:28 AM To: 'Log4J Users List' Subject: RE: Globally MDC.put/remove for hole web application You could probably do it with a servlet filter. James Stauffer -Original Message- From: Stefan Preuss [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 1:35 AM To: [EMAIL PROTECTED] Subject: Globally MDC.put/remove for hole web application Hi, is it possible to set/remove properties on MDC globally for the hole web application (for every client request) instead of doing it in every JSP and Servlet? Thanks. Stefan - 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] ___ Stefan Preuss PROSTEP GIDA GmbH Albert-Einstein-Str. 16 D-12489 Berlin Email: [EMAIL PROTECTED] ___ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
setting separate log files for debug,info and error messges log
hi, i need to have a separate log files for error,info and debug for my application.how do i set it in property file of log4j regards guru
Re: setting separate log files for debug,info and error messges log
Quoting Guruprasanth [EMAIL PROTECTED]: hi, i need to have a separate log files for error,info and debug for my application.how do i set it in property file of log4j regards guru http://wiki.apache.org/logging-log4j/Log4JProjectPages/LogByLevel Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logging per user
Hi guys, I am a newbie to log4j. I quickly looked through log4j and it really looks great and I amazed by its flexibility. I am having a web application and I have a bunch of users 20 -25..using it. I would like to be able to have one log file per user..with an option to configure the users in a properties file. The logfile will be generated only for the configured users. I have been looking at NDC..is that the one I should be using? NDC.clear(); NDC.push(userName); But how would a separate file created for each user? Can someone please provide me some examples.. Thanks - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢