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 "Peter A. Kirk" <pk...@alpha-solutions.dk> on 2010/02/24 02:25:37 UTC

logging

Hi

in the Solr example, how do I configure debug logging to a file?

Thanks,
Peter

Re: logging

Posted by Markus Jelsma <ma...@buyways.nl>.
Hi Peter,


It depends on what you call a debug log and how you interface with Solr.
Anyway, if you use Solr over HTTP you can check out the logs of your
servlet container and configure the logging behaviour on the Solr web
admin page. Usually, the default logging is quite useful. Either way, see
the the Tomcat [1] or Jetty [2] wiki pages for some information on the
commonly used servlet containers. Also, see a specific page on logging.
[3].

[1]: http://wiki.apache.org/solr/SolrTomcat
[2]: http://wiki.apache.org/solr/SolrJetty
[3]: http://wiki.apache.org/solr/SolrLogging


Cheers,


Peter A. Kirk said:
> Hi
>
> in the Solr example, how do I configure debug logging to a file?
>
> Thanks,
> Peter




RE: logging

Posted by Chris Hostetter <ho...@fucit.org>.
: Hi, thanks. I looked at these sites, and also the info about "java 
: logging": 
: http://java.sun.com/j2se/1.5.0/docs/guide/logging/overview.html
: 
: But I couldn't really follow the info about configuration for logging.

typically you create a logging.properties file and put it in your 
classpath -- but there are frequently easier ways to control the logging 
based on the servlet container that's running Solr. Hence my suggestion 
that you look at the Jetty wiki page (since you asked about Jetty) ... but 
i see now that page links you to a jetty tutorial that no longer seems to 
exist ... which is a pity.

I honestly have no idea what the Jetty recommended manner is for 
configuring JUL as it might be used by webapps like Solr.  Jetty has a lot 
of documentation about how it uses SLF4J if it finds it in the 
(global) classpath, so you could consider adding the SLF4J jars of your 
choice, and then configure everything in a single manner externally.

: The user manual for SLF4J tells you how to call the log methods - but 
: not how to actually configure it to write to a file: 

I think you are missunderstanding the point of SLF4J -- it's an 
abstraction layer that exists only as an internal API.  it has no 
configuration mechanism of anykind, it just proxies to whatever 
implementation is wired in at runtime based on the jars that get loaded.

solr.war has the slf4j-jdk14-*.jar bundled into it, so it uses JDK (aka 
JUL aka JDK 1.4) logging by default which (as i mentioned) ... "typically 
you create a logging.properties file and put it in your classpath -- but 
there are frequently easier ways to control the logging based on the 
servlet container that's running Solr."

In any case, it soundsl like you did in fact get Java to load your 
logging.properties file, and you did in fact get log messages into your 
files, but...

	...
: And here I can see lots of log stuff... but not my own, so something's not right.

...what is "lots of log stuff" ? ... what is "my own" that you are 
expecting to see, but aren't? ... what exactly are you doing? (ie: what 
code did you write, how are you running jetty, where did you put your 
logging.properties, etc...  details, details, details.)



-Hoss


RE: logging

Posted by "Peter A. Kirk" <pk...@alpha-solutions.dk>.
Hi, thanks. I looked at these sites, and also the info about "java logging": http://java.sun.com/j2se/1.5.0/docs/guide/logging/overview.html

But I couldn't really follow the info about configuration for logging.

The user manual for SLF4J tells you how to call the log methods - but not how to actually configure it to write to a file: http://www.slf4j.org/manual.html

As I understand it, solr 1.4 out-of-the-box uses SLF4J, which by default uses "java logging". Can you direct me to the info which tells how to configure this? So I can for example tell it to log all "INFO" log for a particular class to a particular file?

For example, at the moment, when I start up the Solr example, I can see the logging written to the console window. I can even see log statements from my own classes here.
But when I try to have the log written to a file, I don't see any of my stuff any more.

As far as I could find out I just need to make a "logging.properties" file?

# Default global logging level:
.level= ALL

# Write to a file:
handlers= java.util.logging.FileHandler

# Write log messages in XML format:
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter 

# Log to the current working directory, with log files named solrxxx.log
java.util.logging.FileHandler.pattern = ./solr%u.log

And here I can see lots of log stuff... but not my own, so something's not right.

Thanks,
Peter

________________________________________
From: Chris Hostetter [hossman_lucene@fucit.org]
Sent: Wednesday, 24 February 2010 8:36 a.m.
To: solr-user@lucene.apache.org
Subject: Re: logging

: in the Solr example, how do I configure debug logging to a file?

http://wiki.apache.org/solr/SolrLogging

...and since you asked specificly about the example, which uses jetty...

http://wiki.apache.org/solr/SolrJetty#Logging



-Hoss

Re: logging

Posted by Chris Hostetter <ho...@fucit.org>.
: in the Solr example, how do I configure debug logging to a file?

http://wiki.apache.org/solr/SolrLogging

...and since you asked specificly about the example, which uses jetty...

http://wiki.apache.org/solr/SolrJetty#Logging



-Hoss