logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <paul.sm...@lawlex.com.au>
Subject Re: [ newbie ]
Date Fri, 15 Aug 2003 00:45:11 GMT
On Fri, 2003-08-15 at 09:15, Schalk wrote:
> I have installed, hopefully, all the files/packages needed for log4j. I
> wrote the log4jInit servlet and it compiled without any problems. I did
> the
> set-up in the web.xml as mentioned in the source course doc. The one
> thing I
> am unsure of is what exactly the log4j.lcf file should contain.


The log4j.lcf file would contain the Log4j configuration information you
wish to use in your circumstances (details of what Appenders to setup,
which Logger's they're bound to etc).

You've got 2 formats to choose for this information.  Standard Java
property syntax, or in XML.  If you were to rename the 'log4j.lcf' file
referenced by your servlet to 'log4j.properties' or 'log4j.xml' Log4j
will automatically detect the appropriate style and configure itself.

However if you name it 'log4j.lcf', your servlet will need to  tell
Log4j which Configurator class to initialize Log4j.  Right now I am sure
your Servlet is either using PropertyConfigurator, or DOMConfigurator to
load your log4j.lcf file.  

So depending on your properties vs XML feelings, choose one (bearing in
mind that the XML DOMConfigurator can specify a couple more things that
the PropertyConfigurator can't, but those features may not be important
to you right now, and it's pretty straight forward to rewrite a property
file into XML).

The details of the format of Properties/XML configuration are defined

(See the doConfigure link)

(The link to the DTD is very useful)

There's a couple of great Wiki documents for you to, so check that out:


in particular, this one is very relevant


I'm sure Ceki won't mind if I plug his book about Log4j, it is excellent


hope this helps!


Paul Smith

To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message