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.

Hi,

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
here:

Properties:
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurator.html
(See the doConfigure link)

XML:
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/xml/DOMConfigurator.html
(The link to the DTD is very useful)

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

http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages

in particular, this one is very relevant

http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/Log4JXmlFormat

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

https://www.qos.ch/shop/products/clm_t.jsp

hope this helps!

cheers,

Paul Smith


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


Mime
View raw message