Hello Remy,

I have made a deeper look at the current cvs logger code stage:

1) ContainerBase.getLogger()

With first getLogger call the Log was build with a strange name!

   public Log getLogger() {

       if (logger != null)
           return (logger);
       String loggerName = null;
       Container current = this;
       while (current != null) {
           loggerName = "[" + current.getName() + "]"
               + ((loggerName != null) ? ("." + loggerName) : "");
           current = current.getParent();
       }
       logger = LogFactory.getLog("Tomcat." + loggerName);
       return (logger);

   }

I think this can be done at init().
head
Context logger    Tomcat.[context].[host].[engine]
Host.logger         Tomcat.[host].[engine]
Engine.Logger     Tomcat.[engine]

Strange syntax...

other convention?:
Context logger    Tomcat.Logger.<engine>.<host>.<context>
                          Tomcat.Logger.<engine>.<host>.ROOT
Host.logger         Tomcat.Logger.<engine>.<host>
Engine.Logger     Tomcat.Logger.<engine>

Current getLogger method not handle ROOT Context!

2) StandardContext.start()
       L4051..
       String logName = "tomcat." + getParent().getName() + "." +
           ("".equals(getName()) ? "ROOT" : getName()) + ".Context";
       log = org.apache.commons.logging.LogFactory.getLog(logName);

Hmm.
Why the complete init() phase goes to Log with name StandardContext.class and
after start all logging goes to "tomcat.<contextname>.Context" ?


  other name convention Tomcat.Context.<contextname>

I thing we must do that, before any code from StandardContext generate log message.
The CatalinaBase use "Tomcat" and StandarContext used "tomcat" with lowercase...


I hope this analyse help to refactor more :-(

regards
peter

Peter Rossbach schrieb:

Hello Remy,

which logging system you used?
I thing every host and application can have there own logging devices.
My problem is:
   How can I configure dymamic logging device at runtime?
   For every new host or application

With the old server.xml Logger element this was easy, but now you must known
there concrete server technic log4j, JDK 1.4 or what ever....


>>
The c-l-api JAR which is in bin doesn't include the log4j wrapper, this could be the cause of the problems.
>>
You mean, that I must add the commons-logging.jar to system-class path?
Ohh, then I must changed the META-INF from bootstrap.jar, right?


regards
Peter
PS: Some people (book writer)  must be the early birds.... :-)

Remy Maucherat schrieb:

Peter Rossbach wrote:

Hello Remy,

I have problems to configure the new logger system.
Can you send a log4J example to demonstrate the new commons-log Logger concept.


How I can configure a log4J system?

I have no success with add log4j.jar and log4j.xml to system class path via setclasspath.bat
set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%BASEDIR%\bin\log4j.jar;%BASEDIR%\bin



I see only the commons logging default messages.

Only my webapp find the log4j.jar and log4j.xml at my common/lib and common/classes
But I want see the server messages


The Logger names are:

Tomcat.<enginename>
Tomcat.<enginename>.<hostname>
Tomcat.<enginename>.<hostname>.<contextname>

correct?



There's no difference with using log4j with the current Tomcat 5.0.x (which I've never done, sorry), except that there are a few more categories.
The c-l-api JAR which is in bin doesn't include the log4j wrapper, this could be the cause of the problems.


It's funny to always see you looking for trouble with odd builds ;)

Rémy


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







--
J2EE Systemarchitekt und Tomcat Experte

http://objektpark.de/
http://www.webapp.de/

Am Josephsschacht 72, 44879 Bochum, Deutschland
Telefon:  (49) 234 9413228
Mobil:    (49) 175 1660884
E-Mail:  [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to