You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Xavier Schepler <xa...@sciences-po.fr> on 2011/02/10 09:41:29 UTC

Tomcat6 and Log4j

Hi,

I added “slf4j-log4j12-1.5.5.jar” and “log4j-1.2.15.jar” to 
$CATALINA_HOME/webapps/solr/WEB-INF/lib ,
then deleted the library “slf4j-jdk14-1.5.5.jar” from 
$CATALINA_HOME/webapps/solr/WEB-INF/lib,
then created a directory $CATALINA_HOME/webapps/solr/WEB-INF/classes.
and created $CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.properties 
with the following contents :

log4j.rootLogger=INFO
log4j.appender.SOLR.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.SOLR.logfile.file=/home/quetelet_bdq/logs/bdq.log
log4j.appender.SOLR.logfile.DatePattern='.'yyyy-MM-dd
log4j.appender.SOLR.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.SOLR.logfile.layout.conversionPattern=%d %p [%c{3}] - 
[%t] - %X{ip}: %m%n
log4j.appender.SOLR.logfile = true

I restarted solr and I got the following message in the catalina.out log :

log4j:WARN No appenders could be found for logger 
(org.apache.solr.core.SolrResourceLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for 
more info.

What is told on this page is that this error occurs what the 
log4j.properties isn't found.

Could someone help me to have it working ?

Thanks in advance,

Xavier

Re: Tomcat6 and Log4j

Posted by Markus Jelsma <ma...@openindex.io>.
Oh, and for sharing purposes; we use a configuration like this one. It'll have 
an info and error log and stores them next to Tomcat's own logs in 
/var/log/tomat on Debian systems (or whatever catalina.base is on other 
distros).

log4j.rootLogger=DEBUG, info, error
 
log4j.appender.info=org.apache.log4j.DailyRollingFileAppender
log4j.appender.info.Threshold=INFO
log4j.appender.info.MaxFileSize=500KB
log4j.appender.info.MaxBackupIndex=20
log4j.appender.info.Append=true
log4j.appender.info.File=${catalina.base}/logs/info.log
log4j.appender.info.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.info.layout=org.apache.log4j.PatternLayout
log4j.appender.info.layout.ConversionPattern=%d %p [%c{3}] - [%t] - %X{ip}: 
%m%n
 
 
log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.error.Threshold=ERROR
log4j.appender.error.File=${catalina.base}/logs/error.log
log4j.appender.error.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.error.layout=org.apache.log4j.PatternLayout
log4j.appender.error.layout.ConversionPattern=%d %p [%c{3}] - [%t] - %X{ip}: 
%m%n
log4j.appender.error.MaxFileSize=500KB
log4j.appender.error.MaxBackupIndex=20



On Thursday 10 February 2011 12:51:13 Markus Jelsma wrote:
> Oh, now looking at your log4j.properties, i believe it's wrong. You
> declared INFO as rootLogger but you use SOLR.
> 
> -log4j.rootLogger=INFO
> +log4j.rootLogger=SOLR
> 
> try again
> 
> On Thursday 10 February 2011 09:41:29 Xavier Schepler wrote:
> > Hi,
> > 
> > I added “slf4j-log4j12-1.5.5.jar” and “log4j-1.2.15.jar” to
> > $CATALINA_HOME/webapps/solr/WEB-INF/lib ,
> > then deleted the library “slf4j-jdk14-1.5.5.jar” from
> > $CATALINA_HOME/webapps/solr/WEB-INF/lib,
> > then created a directory $CATALINA_HOME/webapps/solr/WEB-INF/classes.
> > and created $CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.properties
> > with the following contents :
> > 
> > log4j.rootLogger=INFO
> > log4j.appender.SOLR.logfile=org.apache.log4j.DailyRollingFileAppender
> > log4j.appender.SOLR.logfile.file=/home/quetelet_bdq/logs/bdq.log
> > log4j.appender.SOLR.logfile.DatePattern='.'yyyy-MM-dd
> > log4j.appender.SOLR.logfile.layout=org.apache.log4j.PatternLayout
> > log4j.appender.SOLR.logfile.layout.conversionPattern=%d %p [%c{3}] -
> > [%t] - %X{ip}: %m%n
> > log4j.appender.SOLR.logfile = true
> > 
> > I restarted solr and I got the following message in the catalina.out log
> > :
> > 
> > log4j:WARN No appenders could be found for logger
> > (org.apache.solr.core.SolrResourceLoader).
> > log4j:WARN Please initialize the log4j system properly.
> > log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> > more info.
> > 
> > What is told on this page is that this error occurs what the
> > log4j.properties isn't found.
> > 
> > Could someone help me to have it working ?
> > 
> > Thanks in advance,
> > 
> > Xavier

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

Re: Tomcat6 and Log4j

Posted by Xavier SCHEPLER <xa...@sciences-po.fr>.
Yes thanks. This works fine :

log4j.rootLogger=INFO, SOLR
log4j.appender.SOLR=org.apache.log4j.DailyRollingFileAppender
log4j.appender.SOLR.file=/home/quetelet_bdq/logs/bdq.log
log4j.appender.SOLR.datePattern='.'yyyy-MM-dd
log4j.appender.SOLR.layout=org.apache.log4j.PatternLayout
log4j.appender.SOLR.layout.conversionPattern=%d %p [%c{3}] - [%t] - %X{ip}: %m%n


--------------------------------------------------------------------------
Tous les courriers électroniques émis depuis la messagerie
de Sciences Po doivent respecter des conditions d'usages.
Pour les consulter rendez-vous sur
http://www.ressources-numeriques.sciences-po.fr/confidentialite_courriel.htm

Re: Tomcat6 and Log4j

Posted by Markus Jelsma <ma...@openindex.io>.
Oh, now looking at your log4j.properties, i believe it's wrong. You declared 
INFO as rootLogger but you use SOLR. 

-log4j.rootLogger=INFO
+log4j.rootLogger=SOLR

try again




On Thursday 10 February 2011 09:41:29 Xavier Schepler wrote:
> Hi,
> 
> I added “slf4j-log4j12-1.5.5.jar” and “log4j-1.2.15.jar” to
> $CATALINA_HOME/webapps/solr/WEB-INF/lib ,
> then deleted the library “slf4j-jdk14-1.5.5.jar” from
> $CATALINA_HOME/webapps/solr/WEB-INF/lib,
> then created a directory $CATALINA_HOME/webapps/solr/WEB-INF/classes.
> and created $CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.properties
> with the following contents :
> 
> log4j.rootLogger=INFO
> log4j.appender.SOLR.logfile=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.SOLR.logfile.file=/home/quetelet_bdq/logs/bdq.log
> log4j.appender.SOLR.logfile.DatePattern='.'yyyy-MM-dd
> log4j.appender.SOLR.logfile.layout=org.apache.log4j.PatternLayout
> log4j.appender.SOLR.logfile.layout.conversionPattern=%d %p [%c{3}] -
> [%t] - %X{ip}: %m%n
> log4j.appender.SOLR.logfile = true
> 
> I restarted solr and I got the following message in the catalina.out log :
> 
> log4j:WARN No appenders could be found for logger
> (org.apache.solr.core.SolrResourceLoader).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> 
> What is told on this page is that this error occurs what the
> log4j.properties isn't found.
> 
> Could someone help me to have it working ?
> 
> Thanks in advance,
> 
> Xavier

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

Re: Tomcat6 and Log4j

Posted by Xavier SCHEPLER <xa...@sciences-po.fr>.
I added it to /etc/default/tomcat6.
What happened is that the same error message appeared twice in /var/log/tomcat6/catalina.out.
Like the same file was loaded twice.


--------------------------------------------------------------------------
Tous les courriers électroniques émis depuis la messagerie
de Sciences Po doivent respecter des conditions d'usages.
Pour les consulter rendez-vous sur
http://www.ressources-numeriques.sciences-po.fr/confidentialite_courriel.htm

Re: Tomcat6 and Log4j

Posted by Markus Jelsma <ma...@openindex.io>.
Add it to the CATALINA_OPTS, on Debian systems you could edit 
/etc/default/tomcat

On Thursday 10 February 2011 12:27:59 Xavier SCHEPLER wrote:
>  -Dlog4j.configuration=$CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.pr
> operties

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

Re: Tomcat6 and Log4j

Posted by Xavier SCHEPLER <xa...@sciences-po.fr>.
Thanks for your response.
How could I do that ?




> ----------------------------------------
> From: Jan Høydahl <ja...@cominvent.com>
> Sent: Thu Feb 10 11:01:15 CET 2011
> To: <so...@lucene.apache.org>
> Subject: Re: Tomcat6 and Log4j
> 
> 
> Have you tried to start Tomcat with -Dlog4j.configuration=$CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.properties
> 
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
> 
> On 10. feb. 2011, at 09.41, Xavier Schepler wrote:
> 
> > Hi,
> > 
> > I added “slf4j-log4j12-1.5.5.jar” and “log4j-1.2.15.jar” to $CATALINA_HOME/webapps/solr/WEB-INF/lib ,
> > then deleted the library “slf4j-jdk14-1.5.5.jar” from $CATALINA_HOME/webapps/solr/WEB-INF/lib,
> > then created a directory $CATALINA_HOME/webapps/solr/WEB-INF/classes.
> > and created $CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.properties with the following contents :
> > 
> > log4j.rootLogger=INFO
> > log4j.appender.SOLR.logfile=org.apache.log4j.DailyRollingFileAppender
> > log4j.appender.SOLR.logfile.file=/home/quetelet_bdq/logs/bdq.log
> > log4j.appender.SOLR.logfile.DatePattern='.'yyyy-MM-dd
> > log4j.appender.SOLR.logfile.layout=org.apache.log4j.PatternLayout
> > log4j.appender.SOLR.logfile.layout.conversionPattern=%d %p [%c{3}] - [%t] - %X{ip}: %m%n
> > log4j.appender.SOLR.logfile = true
> > 
> > I restarted solr and I got the following message in the catalina.out log :
> > 
> > log4j:WARN No appenders could be found for logger (org.apache.solr.core.SolrResourceLoader).
> > log4j:WARN Please initialize the log4j system properly.
> > log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
> > 
> > What is told on this page is that this error occurs what the log4j.properties isn't found.
> > 
> > Could someone help me to have it working ?
> > 
> > Thanks in advance,
> > 
> > Xavier
> 


--------------------------------------------------------------------------
Tous les courriers électroniques émis depuis la messagerie
de Sciences Po doivent respecter des conditions d'usages.
Pour les consulter rendez-vous sur
http://www.ressources-numeriques.sciences-po.fr/confidentialite_courriel.htm

Re: Tomcat6 and Log4j

Posted by Jan Høydahl <ja...@cominvent.com>.
Have you tried to start Tomcat with -Dlog4j.configuration=$CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.properties

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 10. feb. 2011, at 09.41, Xavier Schepler wrote:

> Hi,
> 
> I added “slf4j-log4j12-1.5.5.jar” and “log4j-1.2.15.jar” to $CATALINA_HOME/webapps/solr/WEB-INF/lib ,
> then deleted the library “slf4j-jdk14-1.5.5.jar” from $CATALINA_HOME/webapps/solr/WEB-INF/lib,
> then created a directory $CATALINA_HOME/webapps/solr/WEB-INF/classes.
> and created $CATALINA_HOME/webapps/solr/WEB-INF/classes/log4j.properties with the following contents :
> 
> log4j.rootLogger=INFO
> log4j.appender.SOLR.logfile=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.SOLR.logfile.file=/home/quetelet_bdq/logs/bdq.log
> log4j.appender.SOLR.logfile.DatePattern='.'yyyy-MM-dd
> log4j.appender.SOLR.logfile.layout=org.apache.log4j.PatternLayout
> log4j.appender.SOLR.logfile.layout.conversionPattern=%d %p [%c{3}] - [%t] - %X{ip}: %m%n
> log4j.appender.SOLR.logfile = true
> 
> I restarted solr and I got the following message in the catalina.out log :
> 
> log4j:WARN No appenders could be found for logger (org.apache.solr.core.SolrResourceLoader).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
> 
> What is told on this page is that this error occurs what the log4j.properties isn't found.
> 
> Could someone help me to have it working ?
> 
> Thanks in advance,
> 
> Xavier