RE: Log4j

"Hue Holleran" <[email protected]>
Newsgroups gmane.comp.java.mvc.devel
Message-ID <000b01c2e9ca$857777e0$150aa8c0@laphueh>
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]]On 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.