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 Cosmin Bucur <co...@gmail.com> on 2005/06/29 18:49:04 UTC

tomcat + log4j problems

Hi , 

This is a problem i've been encountering every now and then and i was
able to fix at times by redeploying my app and restarting tomcat ...
if that makes any sense .

Anywais , I just moved to a new linux server , still on tomcat 5.0.28
, and for a day and a half I have not been able to get log4j to tell
me why the app can't be deployed .

Normally I'd get a list of exceptions , messages , stack traces . All
I get now is :

Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Skipped installing application listeners due to previous error(s) 
Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start 
SEVERE: Error listenerStart 
Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start 
SEVERE: Context startup failed due to previous errors 

I tried both with the log4j.properties file in myapp/WEB-INF/classes : 


log4j.appender.stdout=org.apache.log4j.ConsoleAppender 
log4j.appender.stdout.Target=System.out 
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n 

log4j.rootLogger=debug, stdout 

and the log4j.properties file in TOMCAT_HOME/common/classes : 

log4j.rootLogger=ERROR, A1 
log4j.appender.A1=org.apache.log4j.ConsoleAppender 
log4j.appender.A1.layout=org.apache.log4j.PatternLayout 

log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n 

log4j.logger.org.apache=DEBUG 

------------------ 

I added the log4j jar in my app , in common/lib , server/lib ,
shared/lib . I tried only with the global log4j.properties or only
with my application's log4j.properties .

NOTHING works . 

Any help will be greately apreciated . 

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: tomcat + log4j problems

Posted by Jacob Kjome <ho...@visi.com>.
One thing to remember about 5.5 is that you will have to use a properties file
if you are using Log4j-1.2.xx.  It is because the names of the Tomcat loggers
are like...

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mywebapp]

The Log4j dtd doesn't allow for the "[" or "]".  However, with Log4j-1.3alpha,
you can do this because it isn't constrained by a DTD.  In any case, here's a
sample properties file for Tomcat-5.5 that might help (note that the A2
appender is commented out in favor of A1 because I use the Tomcat NT Service
which directs all console stuff to a "stdout.log" file on its own)....


log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n

#log4j.appender.A2=org.apache.log4j.FileAppender
#log4j.appender.A2.File=${catalina.home}/logs/stdout.log
#log4j.appender.A2.Append=false
#log4j.appender.A2.layout=org.apache.log4j.PatternLayout
#log4j.appender.A2.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n

log4j.appender.LOCALHOST=org.apache.log4j.RollingFileAppender
log4j.appender.LOCALHOST.File=${catalina.home}/logs/localhost.log
log4j.appender.LOCALHOST.MaxFileSize=1000KB
log4j.appender.LOCALHOST.MaxBackupIndex=1
log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout
log4j.appender.LOCALHOST.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r -
%m%n

log4j.appender.MYWEBAPP=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MYWEBAPP.File=${catalina.home}/logs/localhost_mywebapp.log
log4j.appender.MYWEBAPP.DatePattern='.'yyyy-MM-dd
log4j.appender.MYWEBAPP.layout=org.apache.log4j.PatternLayout
log4j.appender.MYWEBAPP.layout.ConversionPattern=%c{1} %-6r - %m%n

log4j.appender.MYOTHERWEBAPP=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MYOTHERWEBAPP.File=${catalina.home}/logs/localhost_rqmtsmgr.log
log4j.appender.MYOTHERWEBAPP.DatePattern='.'yyyy-MM-dd
log4j.appender.MYOTHERWEBAPP.layout=org.apache.log4j.PatternLayout
log4j.appender.MYOTHERWEBAPP.layout.ConversionPattern=%c{1} %-6r - %m%n


log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mywebapp]=INFO,
MYWEBAPP
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mywebapp]=false

log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myotherwebapp]=INFO,
MYOTHERWEBAPP
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myotherwebapp]=false

log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO,
LOCALHOST
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=false

log4j.rootLogger=INFO, A1



Jake

Quoting Cosmin Bucur <co...@gmail.com>:

> moving to 5.5 is an option .
>
> In fact my problem started when I tried moving to 5.5 , my logging
> config did not work , then tried moving back to 5.0 to find that my
> logging config does not work here anymore ...
>
>
> I have never written an xml file for log4j ... but i'd like to use xml
> rather than property files .
>
> I did however try the 5.5 with log4j.properties file in common/classes
> and that did not work ... i will give 5.5 another shot now then .
>
> thanks for your help
>
> cosmin
>
> On 6/29/05, Jacob Kjome <ho...@visi.com> wrote:
> > Getting Tomcat 5.0.28 to use Log4j can be a bit of a feat.  Tomcat uses
> > commons-logging.  I can't remember all the details, but I think getting
> > Tomcat's commons-logging to use Log4j as its logging implementation
> requires
> > changing out the commons-logging-api.jar that is loaded in the bootstrap
> > process to use commons-logging.jar which actually includes the Log4j
> adapter.
> > I imagine, then, you'd also have to put Log4j in the bootstrap classpath
> along
> > with commons-logging.  5.5 is much more friendly about this.  You just drop
> > commons-logging.jar and log4j.jar into common/lib and log4j.xml into
> > common/classes and it just works.  If you continue to have problems, I
> would
> > search the Tomcat-user list for details on getting Tomcat-5.0.xx to use
> Log4j.
> > I haven't used 5.0.xx for ages so I my help is only as good as my memory.
> >
> >
> > Jake
> >
> > Quoting Cosmin Bucur <co...@gmail.com>:
> >
> > > Hi ,
> > >
> > > This is a problem i've been encountering every now and then and i was
> > > able to fix at times by redeploying my app and restarting tomcat ...
> > > if that makes any sense .
> > >
> > > Anywais , I just moved to a new linux server , still on tomcat 5.0.28
> > > , and for a day and a half I have not been able to get log4j to tell
> > > me why the app can't be deployed .
> > >
> > > Normally I'd get a list of exceptions , messages , stack traces . All
> > > I get now is :
> > >
> > > Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext
> > > listenerStart
> > > SEVERE: Skipped installing application listeners due to previous error(s)
> > > Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
> > > SEVERE: Error listenerStart
> > > Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
> > > SEVERE: Context startup failed due to previous errors
> > >
> > > I tried both with the log4j.properties file in myapp/WEB-INF/classes :
> > >
> > >
> > > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> > > log4j.appender.stdout.Target=System.out
> > > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
> -
> > > %m%n
> > >
> > > log4j.rootLogger=debug, stdout
> > >
> > > and the log4j.properties file in TOMCAT_HOME/common/classes :
> > >
> > > log4j.rootLogger=ERROR, A1
> > > log4j.appender.A1=org.apache.log4j.ConsoleAppender
> > > log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> > >
> > > log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
> > >
> > > log4j.logger.org.apache=DEBUG
> > >
> > > ------------------
> > >
> > > I added the log4j jar in my app , in common/lib , server/lib ,
> > > shared/lib . I tried only with the global log4j.properties or only
> > > with my application's log4j.properties .
> > >
> > > NOTHING works .
> > >
> > > Any help will be greately apreciated .
> > >
> > > thanks
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: tomcat + log4j problems

Posted by Cosmin Bucur <co...@gmail.com>.
moving to 5.5 is an option . 

In fact my problem started when I tried moving to 5.5 , my logging
config did not work , then tried moving back to 5.0 to find that my
logging config does not work here anymore ...


I have never written an xml file for log4j ... but i'd like to use xml
rather than property files .

I did however try the 5.5 with log4j.properties file in common/classes
and that did not work ... i will give 5.5 another shot now then .

thanks for your help 

cosmin

On 6/29/05, Jacob Kjome <ho...@visi.com> wrote:
> Getting Tomcat 5.0.28 to use Log4j can be a bit of a feat.  Tomcat uses
> commons-logging.  I can't remember all the details, but I think getting
> Tomcat's commons-logging to use Log4j as its logging implementation requires
> changing out the commons-logging-api.jar that is loaded in the bootstrap
> process to use commons-logging.jar which actually includes the Log4j adapter.
> I imagine, then, you'd also have to put Log4j in the bootstrap classpath along
> with commons-logging.  5.5 is much more friendly about this.  You just drop
> commons-logging.jar and log4j.jar into common/lib and log4j.xml into
> common/classes and it just works.  If you continue to have problems, I would
> search the Tomcat-user list for details on getting Tomcat-5.0.xx to use Log4j.
> I haven't used 5.0.xx for ages so I my help is only as good as my memory.
> 
> 
> Jake
> 
> Quoting Cosmin Bucur <co...@gmail.com>:
> 
> > Hi ,
> >
> > This is a problem i've been encountering every now and then and i was
> > able to fix at times by redeploying my app and restarting tomcat ...
> > if that makes any sense .
> >
> > Anywais , I just moved to a new linux server , still on tomcat 5.0.28
> > , and for a day and a half I have not been able to get log4j to tell
> > me why the app can't be deployed .
> >
> > Normally I'd get a list of exceptions , messages , stack traces . All
> > I get now is :
> >
> > Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext
> > listenerStart
> > SEVERE: Skipped installing application listeners due to previous error(s)
> > Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
> > SEVERE: Error listenerStart
> > Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
> > SEVERE: Context startup failed due to previous errors
> >
> > I tried both with the log4j.properties file in myapp/WEB-INF/classes :
> >
> >
> > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> > log4j.appender.stdout.Target=System.out
> > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> > log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
> > %m%n
> >
> > log4j.rootLogger=debug, stdout
> >
> > and the log4j.properties file in TOMCAT_HOME/common/classes :
> >
> > log4j.rootLogger=ERROR, A1
> > log4j.appender.A1=org.apache.log4j.ConsoleAppender
> > log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> >
> > log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
> >
> > log4j.logger.org.apache=DEBUG
> >
> > ------------------
> >
> > I added the log4j jar in my app , in common/lib , server/lib ,
> > shared/lib . I tried only with the global log4j.properties or only
> > with my application's log4j.properties .
> >
> > NOTHING works .
> >
> > Any help will be greately apreciated .
> >
> > thanks
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> 
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: tomcat + log4j problems

Posted by Jacob Kjome <ho...@visi.com>.
Getting Tomcat 5.0.28 to use Log4j can be a bit of a feat.  Tomcat uses
commons-logging.  I can't remember all the details, but I think getting
Tomcat's commons-logging to use Log4j as its logging implementation requires
changing out the commons-logging-api.jar that is loaded in the bootstrap
process to use commons-logging.jar which actually includes the Log4j adapter. 
I imagine, then, you'd also have to put Log4j in the bootstrap classpath along
with commons-logging.  5.5 is much more friendly about this.  You just drop
commons-logging.jar and log4j.jar into common/lib and log4j.xml into
common/classes and it just works.  If you continue to have problems, I would
search the Tomcat-user list for details on getting Tomcat-5.0.xx to use Log4j. 
I haven't used 5.0.xx for ages so I my help is only as good as my memory.


Jake

Quoting Cosmin Bucur <co...@gmail.com>:

> Hi ,
>
> This is a problem i've been encountering every now and then and i was
> able to fix at times by redeploying my app and restarting tomcat ...
> if that makes any sense .
>
> Anywais , I just moved to a new linux server , still on tomcat 5.0.28
> , and for a day and a half I have not been able to get log4j to tell
> me why the app can't be deployed .
>
> Normally I'd get a list of exceptions , messages , stack traces . All
> I get now is :
>
> Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext
> listenerStart
> SEVERE: Skipped installing application listeners due to previous error(s)
> Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
> SEVERE: Error listenerStart
> Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
> SEVERE: Context startup failed due to previous errors
>
> I tried both with the log4j.properties file in myapp/WEB-INF/classes :
>
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.Target=System.out
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
> %m%n
>
> log4j.rootLogger=debug, stdout
>
> and the log4j.properties file in TOMCAT_HOME/common/classes :
>
> log4j.rootLogger=ERROR, A1
> log4j.appender.A1=org.apache.log4j.ConsoleAppender
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>
> log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
>
> log4j.logger.org.apache=DEBUG
>
> ------------------
>
> I added the log4j jar in my app , in common/lib , server/lib ,
> shared/lib . I tried only with the global log4j.properties or only
> with my application's log4j.properties .
>
> NOTHING works .
>
> Any help will be greately apreciated .
>
> thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org