RE: configureAndWatch

2004-06-11 Thread Adrian Beech
G'day, Could you possibly explain as to why this is so? AB -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Saturday, 12 June 2004 5:25 AM To: Log4J Users List Subject: Re: configureAndWatch Hello Mike, It is *not* OK to use configureAndWatch in a web-app. At 09:

Property Configurator

2004-06-11 Thread Viv Kap
Hi I have a J2EE application and we use log4j for logging. We used log4j.properties files and packaged it in a war under WEB-INF/classes. It all worked fine under Weblogic, Tomcat etc. But now when we migrated to JBoss it has its own log4j.xml file. So our application grabbed it as the first one

chainsaw default format for detail panel + xmlfile loading

2004-06-11 Thread Stephen Pain
Based on my experience so far with chainsaw, I don't think it's possible to save the layout of the detail panel. So I have a small request - can the %throwable be surrounded by ? It makes it much easier to read, IMHO. For quick copy-paste if someone (Scott/Paul?) agrees: Throwable%throwable

RE: Separate log file per servlet

2004-06-11 Thread Ceki Gülcü
As long as you don't mark the logger variable in class X as static, the solution I suggested earlier should work like a charm. At 11:10 PM 6/11/2004, you wrote: Sorry, in an earlier java prototype we had problems with static objects. There were two applications that use separate loggers. Everythi

RE: Separate log file per servlet

2004-06-11 Thread Horry, Adam J
Sorry, in an earlier java prototype we had problems with static objects. There were two applications that use separate loggers. Everything worked well because they were in their own JVM. When they were combined into one JVM, the first one to be invoked got the static object and both then wrote to t

RE: Separate log file per servlet

2004-06-11 Thread Scott Deboy
Chainsaw can read log files created using XmlLayout, but it can also read log files created using PatternLayout. The JavaDoc of LogFilePatternReceiver provides an example. Using a log file with this patternLayout: %d %-5p [%t] %C{2} (%F:%L) - %m%n Can be processed by Chainsaw using a LogFilePa

RE: Separate log file per servlet

2004-06-11 Thread Ceki Gülcü
At 10:38 PM 6/11/2004, you wrote: What about static objects in the JVM? Would each Servlet get their own instance of X or will it get the static one? What do you mean by static objects in the JVM If the Servlet spawned off threads? Then it should still work because you have not changed the TL. Does

RE: Separate log file per servlet

2004-06-11 Thread James Stauffer
I have an appender that extends FileAppender. The relevant method is below. protected void subAppend(LoggingEvent event) { if(separate) { try {//First reset the file so each new log gets a new file. setFile(getFile(), getAppend(), getBufferedIO(), getBufferSize());

RE: Separate log file per servlet

2004-06-11 Thread Horry, Adam J
Thanks, I brough up chainsaw and am looking at how to use it. One quick question from the docs. Does the log file have to be in xml? Adam -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Friday, June 11, 2004 3:14 PM To: Log4J Users List Subject: RE: Separate log fi

RE: Separate log file per servlet

2004-06-11 Thread Horry, Adam J
What about static objects in the JVM? Would each Servlet get their own instance of X or will it get the static one? If the Servlet spawned off threads? Then it should still work because you have not changed the TL. Does that sound right? I was just trying to mentally think what will happen when s

RE: Separate log file per servlet

2004-06-11 Thread Horry, Adam J
Ok, I was staring at this idea and wanted to make sure I understood it correctly. I know how to set the MDC Value. So I would write my own appender (or extend on that I wanted to use like DailyRollingFileAppender). I would overwrite the append() or doAppend() to set the fileName based on the MDC

Re: configureAndWatch

2004-06-11 Thread Ceki Gülcü
Hello Mike, It is *not* OK to use configureAndWatch in a web-app. At 09:09 PM 6/11/2004, you wrote: Is it OK to use configureAndWatch in a Servlet? Mike -- Ceki Gülcü For log4j documentation consider "The complete log4j manual" ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp

RE: Separate log file per servlet

2004-06-11 Thread Scott Deboy
I think Chainsaw might be able to help here. I'd suggest setting an MDC on the servlet's entry point (say 'servlet' key with the value being the servlet class), and then using patternlayout, set up all of the fields you need to log (including this newly-added MDC entry). All of the servlets can l

configureAndWatch

2004-06-11 Thread Lutz Michael
Is it OK to use configureAndWatch in a Servlet? Mike --- This message and any included attachments are from Siemens Medical Solutions USA, Inc. and are intended only for the addressee(s). The information contained h

Re: Separate log file per servlet

2004-06-11 Thread Ceki Gülcü
Do you have control over class X? If you do, then you use a ThreadLocal variable to set the servlet name from inside the servlet and retreive the name from class X. Assume the threadlocal variable is called TL. This is what will happen: servlet1 sets the TL to "servlet1" servlet 1 creates an

RE: Separate log file per servlet

2004-06-11 Thread James Stauffer
You could Have each servlet set an MDC value and then write your own Appender that uses that MDC value in the filename. James Stauffer -Original Message- From: Horry, Adam J [mailto:[EMAIL PROTECTED] Sent: Friday, June 11, 2004 1:49 PM To: Log4J Users List Subject: RE: Separate log file

RE: Separate log file per servlet

2004-06-11 Thread Horry, Adam J
Unfortunately, I have a Web Architect who wants it this way and it is my job to make it happen. My original idea was to output to a log in XML and then create an XML tool to filter/sort/etc. I had thought of the stack trace method but that seemed like a performance hog. I thought about messing

RE: Separate log file per servlet

2004-06-11 Thread James Stauffer
You could set an MDC with the servlet name and then filter the logs. James Stauffer -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, June 11, 2004 12:59 PM To: Log4J Users List Subject: RE: Separate log file per servlet Hi, >1) What is the reason for se

RE: Separate log file per servlet

2004-06-11 Thread Shapira, Yoav
Hi, >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? In my example, I set additivity to false for all the appenders, because I didn't know what was in the rest of his config

RE: Separate log file per servlet

2004-06-11 Thread Lutz Michael
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:[EM

RE: Separate log file per servlet

2004-06-11 Thread Horry, Adam J
I tried that but the delima comes from the shared class. We want the instance of Class X that ServletY is using to write to the /tmp/ServletY.log and the instance of Class X that ServletZ is using to write to the /tmp/ServletZ.log. Obviously I have struggled trying to prototype an example that wo

RE: Separate log file per servlet

2004-06-11 Thread Horry, Adam J
Around 7 but will probably grow. They all may share common classes but they want the information from that instance to go into the log of the servlet that called started. -Original Message- From: James Stauffer [mailto:[EMAIL PROTECTED] Sent: Friday, June 11, 2004 1:21 PM To: 'Log4J Use

RE: Separate log file per servlet

2004-06-11 Thread Shapira, Yoav
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.

RE: Separate log file per servlet

2004-06-11 Thread James Stauffer
How many servlets do you have? You could try: xLog = getLogger(ServletY.getClass().getName()); Then make one appender per servlet. Are you saying that you want the class X to log to the log of the servlet that called it? James Stauffer -Original Message- From: Horry, Adam J [mailto:[E

Separate log file per servlet

2004-06-11 Thread Horry, Adam J
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 { ...

very quick configureAndWatch question

2004-06-11 Thread Lutz Michael
For Log4j 1.2.8 running in a Servlet Container, can I safely use configureAndWatch? My impression is that there are issues with this in EJB because of the spec, I was wondering if this also holds true for the Servlet world. Thanks in advance. Mike