Reputation: 6146
I have Solr 4 running in Tomcat 6. The application is running just fine, but I'm having trouble getting Tomcat to write the logs where I want. Here are the relevant parts of my conf/logging.properties
file.
handlers = 1catalina.org.apache.juli.FileHandler, \
2localhost.org.apache.juli.FileHandler, \
3manager.org.apache.juli.FileHandler, \
4host-manager.org.apache.juli.FileHandler, \
5solr.org.apache.juli.FileHandler, \
java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
5solr.org.apache.juli.FileHandler.level = FINE
5solr.org.apache.juli.FileHandler.directory = /var/log/solr
5solr.org.apache.juli.FileHandler.prefix = solr.
# SNIP...
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].handlers = 5solr.org.apache.juli.FileHandler
# SNIP...
I've snipped out the settings for Handler
s 1 - 4, because I have not changed them from what they were when I installed Tomcat.
When I start up Tomcat, it creates the following log files.
$ ls -l $CATALINA_HOME/logs
-rw-rw-r-- 1 webapp webapp 11836 Feb 4 18:29 catalina.2013-02-04.log
-rw-rw-r-- 1 webapp webapp 11836 Feb 4 18:29 catalina.out
$ ls /var/log/solr -l
-rw-rw-r-- 1 webapp webapp 0 Feb 4 18:29 solr.2013-02-04.log
The files catalina.out
and catalina.2013-02-04.log
contain the log output for Solr. What I was trying to do with logging.properties
was put the Solr logs in /var/log/solr
.
I expect what happened is that Tomcat picked up my changes to logging.properties
and created the log file in /var/log/solr
, but Solr's log messages are not going to the right place, and end up going all the way up to the root logger.
Solr uses SLF4J, which should be able to write logs to the java.util.logging
interface, but Tomcat reimplements part of that interface (JULI) to allow for having a separate logger per context. Is there some incompatibility between SLF4J and JULI? How can I get around this?
Upvotes: 1
Views: 679
Reputation: 52799
You should set the solr handlers to the newly added handler :-
org.apache.solr.level = INFO
org.apache.solr.handlers = 5solr.org.apache.juli.FileHandler
Upvotes: 1