

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
20 messages in org.apache.logging.log4j-userRE: Separate log file per servlet| From | Sent On | Attachments |
|---|---|---|
| Horry, Adam J | Jun 11, 2004 10:05 am | |
| James Stauffer | Jun 11, 2004 10:20 am | |
| Shapira, Yoav | Jun 11, 2004 10:23 am | |
| Horry, Adam J | Jun 11, 2004 10:29 am | |
| Horry, Adam J | Jun 11, 2004 10:33 am | |
| Lutz Michael | Jun 11, 2004 10:33 am | |
| Shapira, Yoav | Jun 11, 2004 10:58 am | |
| James Stauffer | Jun 11, 2004 11:02 am | |
| Horry, Adam J | Jun 11, 2004 11:48 am | |
| James Stauffer | Jun 11, 2004 11:50 am | |
| Ceki Gülcü | Jun 11, 2004 12:08 pm | |
| Scott Deboy | Jun 11, 2004 12:13 pm | |
| Horry, Adam J | Jun 11, 2004 1:29 pm | |
| Horry, Adam J | Jun 11, 2004 1:37 pm | |
| Horry, Adam J | Jun 11, 2004 1:40 pm | |
| James Stauffer | Jun 11, 2004 1:42 pm | |
| Ceki Gülcü | Jun 11, 2004 1:49 pm | |
| Scott Deboy | Jun 11, 2004 1:50 pm | |
| Horry, Adam J | Jun 11, 2004 2:10 pm | |
| Ceki Gülcü | Jun 11, 2004 2:16 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | RE: Separate log file per servlet | Actions... |
|---|---|---|
| From: | Lutz Michael (mich...@siemens.com) | |
| Date: | Jun 11, 2004 10:33:59 am | |
| List: | org.apache.logging.log4j-user | |
Yoav,
I should know this but may I also ask ...
1) What is the reason for setting additivity to false in this scenario 2) does additivity need to be set to false for each appender in this scenario, or only the first?
Thanks Yoav!
Mike
-----Original Message----- From: Shapira, Yoav [mailto:Yoav...@mpi.com] Sent: Friday, June 11, 2004 1:24 PM To: Log4J Users List Subject: RE: Separate log file per servlet
Hi, Here's one cleaner way, doing nearly everything in the configuration file:
log4j.properties: log4j.appender.foo.bar.appender = ... log4j.logger.foo.bar = foo.bar.appender, DEBUG log4j.logger.foo.bar.additivity = false
log4j.appender.foo.baz.appender = ... log4j.logger.foo.baz = foo.baz.appender, DEBUG ...
Configure log4j once via automatic configuration or whatever mechanism you desire.
Other approaches exist as well, nearly everything would be cleaner than the approach in your email: you don't want to configure (andWatch!) log4j once from each servlet.
Yoav Shapira Millennium Research Informatics
-----Original Message----- From: Horry, Adam J [mailto:adam...@lmco.com] Sent: Friday, June 11, 2004 1:06 PM To: log4...@logging.apache.org Subject: Separate log file per servlet
The web server is configured to be one JVM for all the servlets. Numerous people are developing different classes. We want each Servlet to write to its own log.
Class X { ... xLog = getLogger( "DEBUG" ); ... xLog.info( "message" ); ... }
Class ServletY extends HttpServlet { ... xLog = getLogger( "DEBUG" ); ... configureAndWatch( ); ... xLog.info( "message" ); ... someMethod() { new X(); } }
Class ServletZ extends HttpServlet { ... xLog = getLogger( "DEBUG" ); ... configureAndWatch( ); ... xLog.info( "message" ); ... someMethod() { new X(); } ... }
log4j.properties: ... Logger name="DEBUG" Appender A ... Appender A ...
Class A extends DailyRollingFileAppender { String _file = null;
a( ) { super.init(); setFile( "" ); }
setFile( aFile ) { // Throw stack trace to figure out which servlet called you ... // add path and .log to get filename like /tmp/ServletY.log or // /tmp/ServletZ.log _file = "newFile"; } }
Now the problem: When the first servlet comes up, say ServletY, it configures and creates /tmp/ServletY.log. ServletY and X write to the file and everyone is happy. Now the next servlet comes up, say ServletZ. It configures and creates /tmp/ServletX.log. Now everything writes to this log but not the other.
So I guess what I am looking for is how I can I do logging on a servlet basis that writes to a particular log. The various support classes need to call something generic because they do not know which specific servlet called them.
Thanks, Adam
adam...@lmco.com
This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.
--------------------------------------------------------------------- To unsubscribe, e-mail: log4...@logging.apache.org For additional commands, e-mail: log4...@logging.apache.org
-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions
USA, Inc. and are intended only for the addressee(s).
The information contained herein may include trade secrets or privileged or
otherwise confidential information. Unauthorized review, forwarding, printing,
copying, distributing, or using such information is strictly prohibited and may
be unlawful. If you received this message in error, or have reason to believe
you are not authorized to receive it, please promptly delete this message and
notify the sender by e-mail with a copy to
Cent...@shs.siemens.com
Thank you







