Thanks Alison!!
Now I'm almost ready with my configuration, but the last (I hope) problem is where to 
put the log4j.properties for the common classes. I've tried putting the file inside 
the jar, on the root folder, and initializing it with the next sentence on a static 
block, in a class located inside of this jar:

static{
        PropertyConfigurator.configure("log4j.properties");
}

When log4j tried to read this file, it throws me a FileNotFoundException.

What am I doing wrong????

Thank you very much!!

Atte,
Carlos Yaconi Hitschfeld
Anexo: 8-4619
Tel�fono: 388-4619


-----Mensaje original-----
De: Alison Ortega [mailto:[EMAIL PROTECTED] 
Enviado el: Mi�rcoles, 11 de Junio de 2003 14:24
Para: [EMAIL PROTECTED]
Asunto: RE: Problem configuring log4j with common classes


What you have looks right, just do a static initializer block in your common classes 
like this: ... code to get the init file name and prefix ... static { 
PropertyConfigurator.configure(prefix+file);
}

It goes in the class/instance data declarations section of your common class.  I 
suppose you could use an init servlet here, but then you would have to deploy your 
common classes as an app, which I didn't want to do. Btw, if you want to not have all 
the app logs duplicated in the common class logs, change the common class properties 
file to use 
log4j.rootCategory = info, appender list
instead of 
log4j.logger...=info, appender list
and that will make the appender in the common class properties file the root one, and 
you can prevent the other loggers (categories) from logging to the parent (root) more 
easily.

Let me know if you have any other questions.

Alison Ortega
North Carolina State University
ACS 
Systems Programmer II
919-513-1417

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to