Hi Dave,

log4j was a bit of a mystery to me. Until ... I realised it revolves around
more of a 'trick', really - as far as I understand it, anyway(!).

log4J seems to sort of 'bind' to a class, viz:

I can declare in a class a logger of type - in my
'/WEB-INF/classes/log4j.properties' file, as follows:

        # Set root category priority to WARN and set its only appender to A1.
        log4j.rootCategory=WARN, A1

        # Notify I would like to log my class
        log4j.category.org.mycompany.MyClass=DEBUG

As I understand it as long as my class is at org.mycompany.MyClass, i.e. a
FQ class name, I can say in my class:

        private final static Logger log = Logger.getLogger(MyClass.class);

(as long as it matches the FQ path listed in the log4j file) ... then this
will pick-up the definition in the log4j file.

This will then give me log output. You could always define this at a higher
level to get the output you need, or you can selectively select the 'class'
you want to log in the file. As I say - this is my understanding only and it
works for me. Hope this helps.

H.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: 13 March 2003 23:35
To: [EMAIL PROTECTED]
Subject: [MVC-Programmers] Log4j


How has everyone init'd log4j? Is there an easy way or do I have to write a
short servlet and modify web.xml???

thanks.

dave s.


_______________________________________________
MVC-Programmers mailing list
[EMAIL PROTECTED]
http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers


_______________________________________________
MVC-Programmers mailing list
[EMAIL PROTECTED]
http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers

Reply via email to