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 Brian Whitman <br...@variogr.am> on 2007/03/03 18:56:11 UTC

logging off

I'm trying to disable all logging from Solr, or at least re-route it  
to a file.

I was finally able to disable Jetty logging through a custom  
org.mortbay.log.Logger class, but I am still seeing the Solr logs,  
which seem to come from java.util.logging.Logger.

Is there a thing I can do in solrconfig to do this?

-Brian


Re: logging off

Posted by Bill Au <bi...@gmail.com>.
FYI, the admin page has a link, [LOGGING], that can be use to change Solr's
logging on the fly.

Bill

On 3/4/07, Chris Hostetter <ho...@fucit.org> wrote:
>
>
> : Hi Brian, all you have to do is create a logging.properties file and
> : call this before starting up solr:
> :
> : System.setProperty("java.util.logging.config.file", home+"/conf/
> : logging.properties");
>
> it's not neccessary to execute any javacode to configurate
> java.util.logging ... that property can be set on the commandline before
> executing java.
>
> : And that will disable console logging. For jetty logging, you need to
> : create a custom Log class that looks like this
>
> i'm no jetty expert, but this should also be controllable via jetty
> configs, without writting any custom code .. greping the xml files in the
> example/etc for "log" should turn up a lot of pointers ... much of what is
> there is commented out by default -- and i believe that's why it goes to
> STDOUT instead of specific files.
>
>
> -Hoss
>
>

Re: logging off

Posted by Chris Hostetter <ho...@fucit.org>.
: Hi Brian, all you have to do is create a logging.properties file and
: call this before starting up solr:
:
: System.setProperty("java.util.logging.config.file", home+"/conf/
: logging.properties");

it's not neccessary to execute any javacode to configurate
java.util.logging ... that property can be set on the commandline before
executing java.

: And that will disable console logging. For jetty logging, you need to
: create a custom Log class that looks like this

i'm no jetty expert, but this should also be controllable via jetty
configs, without writting any custom code .. greping the xml files in the
example/etc for "log" should turn up a lot of pointers ... much of what is
there is commented out by default -- and i believe that's why it goes to
STDOUT instead of specific files.


-Hoss


Re: logging off

Posted by Brian Whitman <br...@variogr.am>.
On Mar 3, 2007, at 12:56 PM, Brian Whitman wrote:

> I'm trying to disable all logging from Solr, or at least re-route  
> it to a file.
>

Hi Brian, all you have to do is create a logging.properties file and  
call this before starting up solr:

System.setProperty("java.util.logging.config.file", home+"/conf/ 
logging.properties");

Your logging.properties file can look like this:

---

handlers= java.util.logging.FileHandler
# Default global logging level.
.level= INFO

# default file output is in user's home directory.
java.util.logging.FileHandler.pattern = %h/Library/Application\  
Support/Your Company/solr%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

---

And that will disable console logging. For jetty logging, you need to  
create a custom Log class that looks like this

package com.yourcompany.solr;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.solr.core.Config;
import org.apache.solr.core.SolrCore;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.servlet.SolrDispatchFilter;
import org.apache.solr.servlet.SolrServlet;
import org.apache.solr.servlet.SolrUpdateServlet;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.log.Logger;
import org.mortbay.jetty.servlet.FilterHolder;
import org.mortbay.util.DateCache;

public class NoLog implements Logger
{
     private static boolean debug = System.getProperty("DEBUG",null)! 
=null;
     private String name;

     static
     {
     }

     public NoLog()
     {
         this(null);
     }

     public NoLog(String name)
     {
         this.name=name==null?"":name;
     }

     public boolean isDebugEnabled()
     {
         return debug;
     }

     public void setDebugEnabled(boolean enabled)
     {
         debug=enabled;
     }

     public void info(String msg,Object arg0, Object arg1)
     {
     }

     public void debug(String msg,Throwable th)
     {
     }

     public void debug(String msg,Object arg0, Object arg1)
     {
     }

     public void warn(String msg,Object arg0, Object arg1)
     {
     }

     public void warn(String msg, Throwable th)
     {
     }

     private String format(String msg, Object arg0, Object arg1)
     {
         return "";
     }

     public Logger getLogger(String name)
     {
         if ((name==null && this.name==null) ||
             (name!=null && name.equals(this.name)))
             return this;
         return new NoLog(name);
     }

     public String toString()
     {
         return "NOLOG"+name;
     }

}

---

And then this before starting jetty

	System.setProperty("org.mortbay.log.class",  
"com.yourcompany.solr.NoLog");
	NoLog noLogger = new NoLog();
	org.mortbay.log.Log.setLog(noLogger);



Now, stop talking to yourself... :)


-Brian








Re: logging off

Posted by gmail <ry...@squid-labs.com>.
sweet.

the logging is java logging... (not one i really know how to deal with)

Can you try setting system property like this:
http://www.exampledepot.com/egs/java.util.logging/Props.html



Brian Whitman wrote:
> I'm trying to disable all logging from Solr, or at least re-route it to 
> a file.
> 
> I was finally able to disable Jetty logging through a custom 
> org.mortbay.log.Logger class, but I am still seeing the Solr logs, which 
> seem to come from java.util.logging.Logger.
> 
> Is there a thing I can do in solrconfig to do this?
> 
> -Brian
> 
>