Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Configuring log4j 1.2.8 with tomcat 4.1.30

Reply
Thread Tools

Configuring log4j 1.2.8 with tomcat 4.1.30

 
 
Rodolfo
Guest
Posts: n/a
 
      07-13-2004
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
 
Reply With Quote
 
 
 
 
Stefan Waldmann
Guest
Posts: n/a
 
      07-13-2004
Rodolfo wrote:
> 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
 
Reply With Quote
 
 
 
 
Rodolfo
Guest
Posts: n/a
 
      07-14-2004
Stefan Waldmann <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...

> 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.PatternL ayout
#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
 
Reply With Quote
 
Juha Laiho
Guest
Posts: n/a
 
      07-15-2004
http://www.velocityreviews.com/forums/(E-Mail 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
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does "additivity" flag in log4j.properties work only with log4j or with Apache Commons Logging as well? Gianni Galore Java 0 09-08-2010 09:26 AM
Log4j configuration: how to suppress internal logs from Log4j? joes Java 1 08-06-2005 04:31 PM
Using log4j with Tomcat 4.1.30 problems with log4j.properties Rodolfo Java 0 07-12-2004 08:56 AM
log4j: locating log4j.proprties in same folder as jar Alex Hunsley Java 2 05-28-2004 09:57 PM
eclipse, junit, log4j, & finding log4j.xml Alexandra Stehman Java 0 01-19-2004 03:25 PM



Advertisments