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 ola nowak <ol...@gmail.com> on 2012/02/20 09:56:07 UTC

Solr logging

Hi,
I want to set my Solr to use log4j and to write log messages into separate
file instead of writing all on standard output. How can I do it? Which jars
should I add? Where should I put log4j.xml file?
Regards,
Alex

Re: Solr logging

Posted by darul <da...@gmail.com>.
This case explained here:

http://stackoverflow.com/questions/762918/how-to-configure-multiple-log4j-for-different-wars-in-a-single-ear

http://techcrawler.wordpress.com/



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760352.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr logging

Posted by François Schiettecatte <fs...@gmail.com>.
Ola

Here is what I have for this:


##########################################################
#
# Log4J configuration for SOLR
#
#   http://wiki.apache.org/solr/SolrLogging
#
#
# 1) Download LOG4J:
#       http://logging.apache.org/log4j/1.2/
#       http://logging.apache.org/log4j/1.2/download.html
#       http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.16/apache-log4j-1.2.16.tar.gz
#       http://newverhost.com/pub//logging/log4j/1.2.16/apache-log4j-1.2.16.tar.gz
#
# 2) Download SLF4J:
#       http://www.slf4j.org/
#       http://www.slf4j.org/download.html
#       http://www.slf4j.org/dist/slf4j-1.6.4.tar.gz
#
# 3) Unpack Solr:
#       jar xvf apache-solr-3.5.0.war
#
# 4) Delete:
#       WEB-INF/lib/log4j-over-slf4j-1.6.4.jar
#       WEB-INF/lib/slf4j-jdk14-1.6.4.jar
#
# 5) Copy:
#       apache-log4j-1.2.16/log4j-1.2.16.jar    ->      WEB-INF/lib
#       slf4j-1.6.4/slf4j-log4j12-1.6.4.jar     ->      WEB-INF/lib
#       log4j.properties (this file)            ->      WEB-INF/classes/ (needs to be created)
#
# 6) Pack Solr:
#       jar cvf apache-solr-3.4.0-omim.war admin favicon.ico index.jsp META-INF WEB-INF
#
#
#   Author:     Francois Schiettecatte
#   Version:    1.0
#
##########################################################



##########################################################
#
# Logging levels (helpful reminder)
#
# DEBUG < INFO < WARN < ERROR < FATAL
#



##########################################################
#
# Logging setup
#

log4j.rootLogger=WARN, SOLR


# Daily Rolling File Appender (SOLR)
log4j.appender.SOLR=org.apache.log4j.DailyRollingFileAppender
log4j.appender.SOLR.File=${catalina.base}/logs/solr.log
log4j.appender.SOLR.Append=true
log4j.appender.SOLR.Encoding=UTF-8
log4j.appender.SOLR.DatePattern='-'yyyy-MM-dd
log4j.appender.SOLR.layout=org.apache.log4j.PatternLayout
log4j.appender.SOLR.layout.ConversionPattern=%d [%t] %-5p %c - %m%n



##########################################################
#
# Logging levels for SOLR
#

# Default logging level
log4j.logger.org.apache.solr=WARN



##########################################################



On Feb 20, 2012, at 5:15 AM, ola nowak wrote:

> Yep. I suppose it is. But I have several applications installed on
> glassfish and I want each one of them to write into separate file. And Your
> solution with this jvm option was redirecting all messages from all apps to
> one file. Does anyone knows how to accomplish that?
> 
> 
> On Mon, Feb 20, 2012 at 11:09 AM, darul <da...@gmail.com> wrote:
> 
>> Hmm, I did not try to achieve this but interested if you find a way...
>> 
>> After I believe than having log4j config file outside war archive is a
>> better solution, if you may need to update its content for example.
>> 
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760322.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>> 


Re: Solr logging

Posted by ola nowak <ol...@gmail.com>.
Yep. I suppose it is. But I have several applications installed on
glassfish and I want each one of them to write into separate file. And Your
solution with this jvm option was redirecting all messages from all apps to
one file. Does anyone knows how to accomplish that?


On Mon, Feb 20, 2012 at 11:09 AM, darul <da...@gmail.com> wrote:

> Hmm, I did not try to achieve this but interested if you find a way...
>
> After I believe than having log4j config file outside war archive is a
> better solution, if you may need to update its content for example.
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760322.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr logging

Posted by darul <da...@gmail.com>.
Hmm, I did not try to achieve this but interested if you find a way...

After I believe than having log4j config file outside war archive is a
better solution, if you may need to update its content for example.

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760322.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr logging

Posted by ola nowak <ol...@gmail.com>.
I've already done that. What I'm more interested is if I can add log4j.xml
to war and where to put to make it works

On Mon, Feb 20, 2012 at 10:49 AM, darul <da...@gmail.com> wrote:

> Yes, you can update your .war archive by adding/removing expected jars.
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760285.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr logging

Posted by darul <da...@gmail.com>.
Yes, you can update your .war archive by adding/removing expected jars.

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760285.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr logging

Posted by ola nowak <ol...@gmail.com>.
Thanks a lot.
I've added (and deleted) those libraries and now I don't get this messages
to stdout :) I see that log4j is running and it can't find its config
file.  I wish I could add this to the solr.war. Is this possible?  I want
to avoid setting paramemeters in glassfish.
Regards,
Alex

On Mon, Feb 20, 2012 at 9:58 AM, darul <da...@gmail.com> wrote:

> I get similar questions in the past :)
>
> http://lucene.472066.n3.nabble.com/Jetty-logging-td3476715.html#a3483146
>
> wish it will help you.
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760173.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr logging

Posted by darul <da...@gmail.com>.
I get similar questions in the past :)

http://lucene.472066.n3.nabble.com/Jetty-logging-td3476715.html#a3483146

wish it will help you.

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-logging-tp3760171p3760173.html
Sent from the Solr - User mailing list archive at Nabble.com.