Hi Renaud,

I empathize with your position.

One of the goals of log4j 1.2 is  to make it very easy for the user to
switch from log4j to j.u.l and vice versa. The most notable difference
will be that in j.u.l you will write

   package com.foo;
   
   import java.util.logging.Logger;
   
   public class Foobar {
   
     static final Logger logger = Logger.getLogger("com.foo.Bar");
   
     ....
   }

In log4j 1.2, you will write

   package com.foo;
   
   import org.apache.log4j..Logger;
   
   public class Foobar {
   
     static final Logger logger = Logger.getLogger("com.foo.Bar");
   
     ....
   }


The only difference is the import statement. The printing methods
finer, and finest are unlikely to be supported. However, the
j.u.l. fine level will be supported by considering it as an alias for
log4j's debug level. In short, your wrapper is likely to make your
migration to (or from) j.u.l. harder, not easier. Regards, Ceki

At 12:07 22.10.2001 -0700, you wrote:
>Ceki made some very good points; I was aware of the issues he brought up,
>and I should have given a bit more context; i.e. why did I create this
>stupid Facade?
>
>The answer lies in the competition coming from the logging package included
>in JDK 1.4. The project I work on already had a feeble, home-grown, logging
>package, and I was pushing to have it replaced with Log4J. Other developers
>said "but let's just wait, JDK 1.4 is just around the corner and will give
>us what you want. Plus it's standard". A heavy argument you see.
>
>But I didn't want to wait: I think having a reliable, flexible logging
>facility is *essential*, and I wanted it yesterday. Log4J fit the bill
>perfectly. So I created this Facade, as an answer to their concern, and it
>allowed me to use Log4J right away, while guaranteeing an easy upgrade path
>to java.util.logging. But frankly, now that we've grown used to Log4J,
>java.util.logging better be damn good to ever replace Log4J in our hearts.
>
>And why didn't I offer log.isInfoEnabled() etc. through the Facade?
>Simplicity. I wanted to have my logging facility adopted right away, by
>everyone, and it had to be brain-dead simple. The way I understand it, those
>convenience methods are there mostly for performance reasons, and I hold
>true the argument that there's nothing worse than worrying about performance
>too early.
>
>Don't get me wrong; I think it's great that they're part of Log4J, I'm
>simply saying we didn't have a need for them; that's the whole idea behind
>the Facade pattern: offer a unified, simplified interface to a subsystem.
>
>--Renaud
>
>
>
>
>----- Original Message -----
>From: "Ceki Gülcü" <[EMAIL PROTECTED]>
>To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>; "Alex Colic"
><[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>Sent: Sunday, October 21, 2001 12:58 PM
>Subject: Re: How to properly use log4j with servlets.
>
>
>
>Renaud,
>
>You realize that you are creating an unnecessary object each time you call
>com.waldura.logging.Logger.getInstance()? Your wrapper costs two extra
>method
>calls. It does not offer a isDebugEnabled, isInfoEnabled checks. It is still
>coupled with log4j. Anyway, it's your call. Ceki
>
>At 12:31 21.10.2001 -0700, Renaud Waldura wrote:
>>> Do you initialise the log4J properties in your Struts action servlet?
>>
>>No. The Facade takes care of that. Upon first call, it will initialize
>>itself.
>>
>>
>>> If you were to go to an xml config format, how do you package the xml
>file
>>
>>I use the ClassLoader. The config file is placed in WEB-INF/classes. It
>>works great with Tomcat, WebLogic 6 seems to be having some trouble with
>>it... I really wonder why, this should be completely portable.
>>
>>See the code, attached.
>>
>>Let me know if you have questions.
>>
>>--Renaud
>>
>>
>>
>>
>>
>>
>>
>>----- Original Message -----
>>From: "Alex Colic" <[EMAIL PROTECTED]>
>>To: "Renaud Waldura" <[EMAIL PROTECTED]>
>>Sent: Sunday, October 21, 2001 9:30 AM
>>Subject: RE: How to properly use log4j with servlets.
>>
>>
>>> Hi,
>>>
>>> thanks for the reply. I found your info very interesting. If you could
>>> elaborate on the following it would help me sketch out what I need to do.
>>>
>>> Do you initialise the log4J properties in your Struts action servlet?
>>>
>>> If you were to go to an xml config format, how do you package the xml
>file
>>> up with your web app. I just place the properties file in the root of my
>>web
>>> app, and then get an instance of the apps path and load it that way.
>Would
>>> you do the same thing with the xml file?
>>>
>>> The Facade idea is great. I should have thought of that. Is that class a
>>> company proprietary one or could you pass it on to me.
>>>
>>> Thanks for any info.
>>>
>>> Alex
>>>
>>> -----Original Message-----
>>> From: Renaud Waldura [mailto:[EMAIL PROTECTED]]
>>> Sent: Sunday, October 21, 2001 2:31 AM
>>> To: [EMAIL PROTECTED]
>>> Cc: LOG4J Users Mailing List
>>> Subject: Re: How to properly use log4j with servlets.
>>>
>>>
>>> We're using Log4J in a medium-sized Webapp, along with Struts and other
>>> stuff.
>>>
>>> I defined a "Logger" Facade that isolates the code base from Log4J; were
>>we
>>> to ever switch logging packages, it'd be a snap. Basically it calls
>>through
>>> to the Category methods. The Facade does the initialization also. BTW if
>>you
>>> can use the XML configuration format, by all means do, it's much easier
>to
>>> set up and maintain than the property file.
>>>
>>> At the top of each action class we have:
>>>
>>> private static final Logger log = Logger.getInstance(MyAction.class);
>>>
>>> then we do:
>>>
>>> log.warn("some harmless error occurred", exception);
>>>
>>> It's very much the same thing.
>>>
>>> --Renaud
>>>
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "Alex Colic" <[EMAIL PROTECTED]>
>>> To: "Log4j" <[EMAIL PROTECTED]>
>>> Sent: Friday, October 19, 2001 1:32 PM
>>> Subject: How to properly use log4j with servlets.
>>>
>>>
>>> > Hi,
>>> >
>>> > I am trying to figure out how to use Log4J with servlets. Presently at
>>the
>>> > top of each class I have:
>>> >
>>> > private static Category cat =
>>> > Category.getInstance(wrEstimatedValuesAction.class.getName());
>>> >
>>> > Then throughout the class I use:
>>> >
>>> > if(cat.isInfoEnabled)
>>> > {
>>> >
>>> > }
>>> >
>>> > Questions:
>>> >
>>> > 1: Lets say you have a lot of servlets, does each servlet load the
>>> > logsettings.properties file?
>>> > 2: I am using Struts with the servlets, anyone have experience using
>>> Log4J.
>>> > Examples, ideas?
>>> >
>>> > Thanks for any info.
>>> >
>>> > Regards
>>> >
>>> > Alex
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > 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]
>
>--
>Ceki Gülcü - http://qos.ch
>Link of the day:
>http://www.washingtonpost.com/wp-dyn/articles/A63884-2001Oct15.html
>
>
>---------------------------------------------------------------------
>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]

--
Ceki Gülcü - http://qos.ch
Link of the day: http://www.washingtonpost.com/wp-dyn/articles/A63884-2001Oct15.html


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

Reply via email to