I think the problem here is that the call to getInstance is in the initializer of a static variable. This means that it is getting run when the class is first loaded. I am not sure about when Tomcat fires up its log4j configuration, but it is very likely that it is after your static initialization gets run. You could force the initialization to happend before your call to getInstance by putting an explicit static initializer in like so.
static Cateogry log; static { PropertyConfigurator.configure("log4j.properties"); log = Category.getInstance(Invoice.class); } If you don't strictly need the Category instance to be static, you could also delay the getInstance call till the constructor. On Tue, 2002-01-22 at 09:00, Don Seiler wrote: OK. Well I commented that line out, still getting the No appenders error. My props file is /usr/local/resin/doc/WEB-INF/classes/log4j.properties. I have my jar file in /usr/local/resin/doc/WEB-INF/lib/me.jar and resin picks it up fine, so I'm assuming that the WEB-INF/classes dir is also in the classpath. *shrug* Don. On Tue, 22 Jan 2002, Sauder Thomas - IWKA Informationssysteme GmbH wrote: > > You don't think I need the PropertyConfigurator line at all? > Yes because your statement > PropertyConfigurator.configure("log4j.properties"); > looks for the properties file in your package dir and there it isn't. > > > On Tue, 22 Jan 2002, Sauder Thomas - IWKA Informationssysteme > > GmbH wrote: > > > > > Hi Don! > > > > > > > I have a java class (Invoice.java) that is called from a jsp > > > > under Resin. > > > > I have this line in the beginning of my class def: > > > > > > > > static Category log = > > Category.getInstance(Invoice.class.getName()); > > > This is OK. > > > > > > > And this line in my constructor: > > > > > > > > PropertyConfigurator.configure("log4j.properties"); > > > I don't think that you need this, because when you put > > log4j.properties in > > > WEB-INF/classes your Web server should load it > > automatically at startup (at > > > least > > > Tomcat is doing so) > > > > > > > Everything compiles fine, but when I try to bring up the jsp > > > > I get this in > > > > the stderr.log in resin: > > > > > > > > log4j:ERROR No appenders could be found for category > > > > (com.foo.Invoice). > > > > log4j:ERROR Please initialize the log4j system properly. > > > It seems that your log4j.properties file has not been found. > > > > > > > I have numerous questions about setup. I defined a > > > > log4j.properties as > > > > this, which I scavenged off example posts: > > > > > > > > log4j.category.com.foo.Invoice=DEBUG, R > > > > log4j.additivity.com.foo.Invoice=false > > > > log4j.appender.R=org.apache.log4j.RollingFileAppender > > > > log4j.appender.R.MaxFileSize=100MB > > > > log4j.appender.R.MaxBackupIndex=4 > > > > [EMAIL PROTECTED]@/opennms-jboss.log > > > > log4j.appender.R.layout=org.apache.log4j.PatternLayout > > > > log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] %c{1}: %m%n > > > I don't know whether you need log4j.rootCategory=DEBUG,R as > > first line. > > > > > > > I put this file in my WEB-INF/classes directory under the > > resin docs > > > > directory. I'm led to believe that the resin java process > > > > will find this > > > > file there. > > > Maybe you have to put it directly under WEB-INF/classes and not in > > > WEB-INF/classes/whatever > > > > > > Regards, > > > Thomas > > > > > > > > > -- > > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> Eric George [EMAIL PROTECTED] hm: 720-855-0484 cell: 720-231-2335