You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jason Novotny <JD...@lbl.gov> on 2002/01/29 02:47:12 UTC

including log4j in library

Hi,

    I'm a new user to log4j and I've developed a library where I use
log4j calls in most of my classes following the standard approach:

public class foo {

private static Category category =
    Category.getInstance(foo.class.getName());

public foo {
    category.debug("in foo");
}

}


    Next I jar up all my classes so I have the following structure:

log4j.properties
META-INF/
META-INF/MANIFEST.MF
org/
org/foo
....

    However when I give an application my library to use I get the
popular

log4j:ERROR No appenders could be found for category (org.foo).
log4j:ERROR Please initialize the log4j system properly.

    I'd like to just be able to include log4j.properties as part of my
packaged jar file.  But how do I instruct the my calls to use that
property file? Since it's a library I don't have a main() method-- I do
however have a ststaic initializer in in eif the classes-- maybe I can
put the initialization code there....

    Thanks, Jason


--
Jason Novotny                jdnovotny@lbl.gov
Grid Technology Group        (510) 486-8662
Lawrence Berkeley Laboratory http://www-itg.lbl.gov/Grid




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>