Configuring log4j 1.2.8 with tomcat 4.1.30

R

Rodolfo

Hi,

I need to configure log4j 1.2.8 with tomcat 4.1.30, I put my
log4j.properties in "classes" directory but I obtain an error :

log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.

I think log4j.properties is correct because I have adapted it from an
example, my doubt is about that is the place of the log4j.jar. I have
put it in myapp/web-inf/lib and commons/lib. Is this place correct? Do
I need to configure a system variable?

thanks in advance

Rodolfo
 
S

Stefan Waldmann

Rodolfo said:
Hi,

I need to configure log4j 1.2.8 with tomcat 4.1.30, I put my
log4j.properties in "classes" directory but I obtain an error :

log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.

I think log4j.properties is correct because I have adapted it from an
example, my doubt is about that is the place of the log4j.jar. I have
put it in myapp/web-inf/lib and commons/lib. Is this place correct? Do
I need to configure a system variable?

thanks in advance

Rodolfo

Hi,

your log4j.jar seems to be in the right place, since you are getting
log4j output. myapp/WEB-INF/lib is the right place for all webapp
specific libs anyway (shouldn't you also put your commons jar files there??)

I can't say more without knowing what your code looks like where log4j
is being initialized. Do you use the PropertyConfigurator? If you do,
how do you load the log4j.properties file?

Regards,
Stefan
 
R

Rodolfo

Stefan Waldmann said:
Hi,

your log4j.jar seems to be in the right place, since you are getting
log4j output. myapp/WEB-INF/lib is the right place for all webapp
specific libs anyway (shouldn't you also put your commons jar files there??)

I can't say more without knowing what your code looks like where log4j
is being initialized. Do you use the PropertyConfigurator? If you do,
how do you load the log4j.properties file?

Regards,
Stefan

Hi,

I don't use PropertyConfigurator, only log4j.properties in the place I
had said. the sentences in the code are :

import org.apache.log4j.Logger;
....
static Logger log = Logger.getLogger(SolicitudVisita.class);
....
log.debug(" Enviando a página de bien");

And the content of log4j.properties is :

log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=d:/Tomcat41/webapps/vicy/log/vicy.log

# Control the maximum log file size
log4j.appender.A1.MaxFileSize=10000KB
# Archive log files (one backup file here)
log4j.appender.A1.MaxBackupIndex=1

log4j.appender.A1.layout=org.apache.log4j.PatternLayout
#log4j.appender.A1.layout.ConversionPattern=%p %t %c - %m%n
log4j.appender.A1.layout.ConversionPattern=%p %c - %m%n

log4j.logger.es.cyii=debug, A1
log4j.additivity.es.cyii=false

If you could say me something why this doesn't work I would appreciate

Thanks in advance

Rodolfo
 
J

Juha Laiho

(e-mail address removed) (Rodolfo) said:
I need to configure log4j 1.2.8 with tomcat 4.1.30, I put my
log4j.properties in "classes" directory but I obtain an error :

log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.

I think log4j.properties is correct because I have adapted it from an
example, my doubt is about that is the place of the log4j.jar. I have
put it in myapp/web-inf/lib and commons/lib. Is this place correct? Do
I need to configure a system variable?

Unless you want to mess up with internal logging of Tomcat, avoid using
common/lib -- jars placed there are also visible to the Tomcat server
code (and as Tomcat uses the jakarta commons logging API, it'll use
log4j if it's accessible).

If you plan on running more than one webapp on this server instance,
I recommend placing the log4j and other jars common to all webapps
into shared/lib. Depending on your set-up, note that shared/lib is
rooted in CATALINA_BASE directory, whereas common/lib is rooted in
CATALINA_HOME. By default these are the same (where Tomcat is installed),
but the former can be set to point to a different location, to make
it easier to separate Tomcat distribution from the actual webapps.

If you want to force use of a log4j.properties file from somewhere
outside your webapp, you can add the following java system property
definition to your Tomcat startup:
-Dlog4j.configuration=file:/path/to/log4j.properties
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top