SOLR-560: Use SLF4J logging API rather then JDK logging. The packaged .war file is

shipped with a JDK logging implementation, so logging configuration for the .war should
    be identical to solr 1.3.  However, if you are using the .jar file, you can select 
    which logging implementation to use by dropping a different binding.  
    See: http://www.slf4j.org/  

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@696539 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2008-09-18 02:16:26 +00:00
parent eef0183217
commit 3c9db8e311
69 changed files with 435 additions and 321 deletions

View File

@ -30,7 +30,12 @@ Detailed Change List
---------------------- ----------------------
New Features New Features
---------------------- 1. SOLR-560: Use SLF4J logging API rather then JDK logging. The packaged .war file is
shipped with a JDK logging implementation, so logging configuration for the .war should
be identical to solr 1.3. However, if you are using the .jar file, you can select
which logging implementation to use by dropping a different binding.
See: http://www.slf4j.org/ (ryan)
Optimizations Optimizations
---------------------- ----------------------

View File

@ -87,4 +87,29 @@ Some portions of the code are Copyright:
1999 Jason Gilbert. 1999 Jason Gilbert.
The jboss integration module contains some LGPL code. The jboss integration module contains some LGPL code.
---
=========================================================================
== SLF4J Notice -- http://www.slf4j.org/license.html ==
=========================================================================
Copyright (c) 2004-2008 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,2 @@
AnyObjectId[01b3e7c893b3e24d40965a9776db0accfb5f0a72] was removed in git history.
Apache SVN contains full history.

View File

@ -0,0 +1,2 @@
AnyObjectId[15e3d442a23ce513d37d518be63e20d8618468bd] was removed in git history.
Apache SVN contains full history.

View File

@ -22,7 +22,8 @@ import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamConstants;
@ -44,7 +45,7 @@ import org.apache.solr.common.util.SimpleOrderedMap;
*/ */
public class XMLResponseParser extends ResponseParser public class XMLResponseParser extends ResponseParser
{ {
public static Logger log = Logger.getLogger(XMLResponseParser.class.getName()); public static Logger log = LoggerFactory.getLogger(XMLResponseParser.class);
// reuse the factory among all parser instances so things like string caches // reuse the factory among all parser instances so things like string caches
// won't be duplicated // won't be duplicated
@ -63,7 +64,7 @@ public class XMLResponseParser extends ResponseParser
catch( IllegalArgumentException ex ) { catch( IllegalArgumentException ex ) {
// Other implementations will likely throw this exception since "reuse-instance" // Other implementations will likely throw this exception since "reuse-instance"
// isimplementation specific. // isimplementation specific.
log.fine( "Unable to set the 'reuse-instance' property for the input factory: "+factory ); log.debug( "Unable to set the 'reuse-instance' property for the input factory: "+factory );
} }
} }

View File

@ -0,0 +1,71 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.solrj;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;
/**
* @since solr 1.3
*/
public class StartSolrJetty
{
public static void main( String[] args )
{
//System.setProperty("solr.solr.home", "../../../example/solr");
Server server = new Server();
SocketConnector connector = new SocketConnector();
// Set some timeout options to make debugging easier.
connector.setMaxIdleTime(1000 * 60 * 60);
connector.setSoLingerTime(-1);
connector.setPort(8080);
server.setConnectors(new Connector[] { connector });
WebAppContext bb = new WebAppContext();
bb.setServer(server);
bb.setContextPath("/");
bb.setWar("src/webapp/web");
// // START JMX SERVER
// if( true ) {
// MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
// MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
// server.getContainer().addEventListener(mBeanContainer);
// mBeanContainer.start();
// }
server.addHandler(bb);
try {
System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
server.start();
while (System.in.available() == 0) {
Thread.sleep(5000);
}
server.stop();
server.join();
}
catch (Exception e) {
e.printStackTrace();
System.exit(100);
}
}
}

View File

@ -35,14 +35,15 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.io.File; import java.io.File;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* @version $Id$ * @version $Id$
* @since solr 1.3 * @since solr 1.3
*/ */
public class TestSolrProperties { public class TestSolrProperties {
protected static Logger log = Logger.getLogger(TestSolrProperties.class.getName()); protected static Logger log = LoggerFactory.getLogger(TestSolrProperties.class);
protected CoreContainer cores = null; protected CoreContainer cores = null;
public String getSolrHome() { public String getSolrHome() {
@ -73,7 +74,7 @@ public class TestSolrProperties {
log.info("NOTE: per solr.test.leavedatadir, dataDir will not be removed: " + dataDir.getAbsolutePath()); log.info("NOTE: per solr.test.leavedatadir, dataDir will not be removed: " + dataDir.getAbsolutePath());
} else { } else {
if (!AbstractSolrTestCase.recurseDelete(dataDir)) { if (!AbstractSolrTestCase.recurseDelete(dataDir)) {
log.warning("!!!! WARNING: best effort to remove " + dataDir.getAbsolutePath() + " FAILED !!!!!"); log.warn("!!!! WARNING: best effort to remove " + dataDir.getAbsolutePath() + " FAILED !!!!!");
} }
} }
File persistedFile = new File(getSolrHome() + File.separator + "solr-persist.xml"); File persistedFile = new File(getSolrHome() + File.separator + "solr-persist.xml");

View File

@ -38,8 +38,8 @@ import org.apache.solr.update.processor.UpdateRequestProcessorChain;
import org.apache.solr.util.plugin.SolrCoreAware; import org.apache.solr.util.plugin.SolrCoreAware;
import java.util.*; import java.util.*;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -63,8 +63,7 @@ import java.util.logging.Logger;
public class DataImportHandler extends RequestHandlerBase implements public class DataImportHandler extends RequestHandlerBase implements
SolrCoreAware { SolrCoreAware {
private static final Logger LOG = Logger.getLogger(DataImportHandler.class private static final Logger LOG = LoggerFactory.getLogger(DataImportHandler.class);
.getName());
private DataImporter importer; private DataImporter importer;
@ -110,7 +109,7 @@ public class DataImportHandler extends RequestHandlerBase implements
} }
} catch (Throwable e) { } catch (Throwable e) {
SolrConfig.severeErrors.add(e); SolrConfig.severeErrors.add(e);
LOG.log(Level.SEVERE, DataImporter.MSG.LOAD_EXP, e); LOG.error( DataImporter.MSG.LOAD_EXP, e);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
DataImporter.MSG.INVALID_CONFIG, e); DataImporter.MSG.INVALID_CONFIG, e);
} }
@ -287,7 +286,7 @@ public class DataImportHandler extends RequestHandlerBase implements
return super.upload(document); return super.upload(document);
} catch (RuntimeException e) { } catch (RuntimeException e) {
LOG.log(Level.SEVERE, "Exception while adding: " + d, e); LOG.error( "Exception while adding: " + d, e);
return false; return false;
} }
} }

View File

@ -32,8 +32,8 @@ import java.io.StringReader;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -51,8 +51,7 @@ public class DataImporter {
IDLE, RUNNING_FULL_DUMP, RUNNING_DELTA_DUMP, JOB_FAILED IDLE, RUNNING_FULL_DUMP, RUNNING_DELTA_DUMP, JOB_FAILED
} }
private static final Logger LOG = Logger.getLogger(DataImporter.class private static final Logger LOG = LoggerFactory.getLogger(DataImporter.class);
.getName());
private Status status = Status.IDLE; private Status status = Status.IDLE;
@ -335,7 +334,7 @@ public class DataImporter {
if (!requestParams.debug) if (!requestParams.debug)
cumulativeStatistics.add(docBuilder.importStatistics); cumulativeStatistics.add(docBuilder.importStatistics);
} catch (RuntimeException e) { } catch (RuntimeException e) {
LOG.log(Level.SEVERE, "Full Import failed", e); LOG.error( "Full Import failed", e);
} finally { } finally {
setStatus(Status.IDLE); setStatus(Status.IDLE);
config.clearCaches(); config.clearCaches();
@ -360,7 +359,7 @@ public class DataImporter {
if (!requestParams.debug) if (!requestParams.debug)
cumulativeStatistics.add(docBuilder.importStatistics); cumulativeStatistics.add(docBuilder.importStatistics);
} catch (RuntimeException e) { } catch (RuntimeException e) {
LOG.log(Level.SEVERE, "Delta Import Failed", e); LOG.error( "Delta Import Failed", e);
} finally { } finally {
setStatus(Status.IDLE); setStatus(Status.IDLE);
config.clearCaches(); config.clearCaches();

View File

@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -43,8 +43,8 @@ import java.util.logging.Logger;
* @since solr 1.3 * @since solr 1.3
*/ */
public class DateFormatTransformer extends Transformer { public class DateFormatTransformer extends Transformer {
private static final Logger LOG = Logger private static final Logger LOG = LoggerFactory
.getLogger(DateFormatTransformer.class.getName()); .getLogger(DateFormatTransformer.class);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Object transformRow(Map<String, Object> aRow, Context context) { public Object transformRow(Map<String, Object> aRow, Context context) {
@ -70,7 +70,7 @@ public class DateFormatTransformer extends Transformer {
aRow.put(column, process(value, fmt)); aRow.put(column, process(value, fmt));
} }
} catch (ParseException e) { } catch (ParseException e) {
LOG.log(Level.WARNING, "Could not parse a Date field ", e); LOG.warn( "Could not parse a Date field ", e);
} }
} }
return aRow; return aRow;

View File

@ -23,8 +23,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -41,8 +41,7 @@ import java.util.logging.Logger;
public class DocBuilder { public class DocBuilder {
public static final String DOC_BOOST = "$docBoost"; public static final String DOC_BOOST = "$docBoost";
private static final Logger LOG = Logger private static final Logger LOG = LoggerFactory.getLogger(DocBuilder.class);
.getLogger(DocBuilder.class.getName());
private DataImporter dataImporter; private DataImporter dataImporter;
@ -330,7 +329,7 @@ public class DocBuilder {
if (e.getErrCode() == DataImportHandlerException.SKIP) { if (e.getErrCode() == DataImportHandlerException.SKIP) {
importStatistics.skipDocCount.getAndIncrement(); importStatistics.skipDocCount.getAndIncrement();
} else { } else {
LOG.log(Level.SEVERE, "Exception while processing: " LOG.error( "Exception while processing: "
+ entity.name + " document : " + doc, e); + entity.name + " document : " + doc, e);
} }
if (e.getErrCode() == DataImportHandlerException.SEVERE) if (e.getErrCode() == DataImportHandlerException.SEVERE)

View File

@ -18,8 +18,8 @@ package org.apache.solr.handler.dataimport;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -37,8 +37,7 @@ import java.util.logging.Logger;
* @since solr 1.3 * @since solr 1.3
*/ */
public class EntityProcessorBase extends EntityProcessor { public class EntityProcessorBase extends EntityProcessor {
private static final Logger LOG = Logger.getLogger(EntityProcessorBase.class private static final Logger log = LoggerFactory.getLogger(EntityProcessorBase.class);
.getName());
protected String entityName; protected String entityName;
@ -102,14 +101,14 @@ public class EntityProcessorBase extends EntityProcessor {
String msg = "Transformer :" String msg = "Transformer :"
+ trans + trans
+ "does not implement Transformer interface or does not have a transformRow(Map m)method"; + "does not implement Transformer interface or does not have a transformRow(Map m)method";
LOG.log(Level.SEVERE, msg); log.error( msg);
throw new DataImportHandlerException( throw new DataImportHandlerException(
DataImportHandlerException.SEVERE, msg); DataImportHandlerException.SEVERE, msg);
} }
transformers.add(new ReflectionTransformer(meth, clazz, trans)); transformers.add(new ReflectionTransformer(meth, clazz, trans));
} }
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.SEVERE, "Unable to load Transformer: " + aTransArr, e); log.error( "Unable to load Transformer: " + aTransArr, e);
throw new DataImportHandlerException(DataImportHandlerException.SEVERE, throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
e); e);
} }
@ -139,8 +138,7 @@ public class EntityProcessorBase extends EntityProcessor {
try { try {
return meth.invoke(o, aRow); return meth.invoke(o, aRow);
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.WARNING, "method invocation failed on transformer : " log.warn("method invocation failed on transformer : "+ trans, e);
+ trans, e);
throw new DataImportHandlerException(DataImportHandlerException.WARN, e); throw new DataImportHandlerException(DataImportHandlerException.WARN, e);
} }
} }
@ -176,9 +174,7 @@ public class EntityProcessorBase extends EntityProcessor {
} else if (o instanceof List) { } else if (o instanceof List) {
tmpRows.addAll((List) o); tmpRows.addAll((List) o);
} else { } else {
LOG log.error("Transformer must return Map<String, Object> or a List<Map<String, Object>>");
.log(Level.SEVERE,
"Transformer must return Map<String, Object> or a List<Map<String, Object>>");
} }
} }
rows = tmpRows; rows = tmpRows;
@ -193,16 +189,14 @@ public class EntityProcessorBase extends EntityProcessor {
} else if (o instanceof List) { } else if (o instanceof List) {
rows = (List) o; rows = (List) o;
} else { } else {
LOG log.error( "Transformer must return Map<String, Object> or a List<Map<String, Object>>");
.log(Level.SEVERE,
"Transformer must return Map<String, Object> or a List<Map<String, Object>>");
} }
} }
} catch (DataImportHandlerException e) { } catch (DataImportHandlerException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.WARNING, "transformer threw error", e); log.warn( "transformer threw error", e);
throw new DataImportHandlerException(DataImportHandlerException.WARN, e); throw new DataImportHandlerException(DataImportHandlerException.WARN, e);
} }
} }
@ -232,7 +226,7 @@ public class EntityProcessorBase extends EntityProcessor {
query = null; query = null;
return null; return null;
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.SEVERE, "getNext() failed for query '" + query + "'", e); log.error( "getNext() failed for query '" + query + "'", e);
rowIterator = null; rowIterator = null;
query = null; query = null;
throw new DataImportHandlerException(DataImportHandlerException.WARN, e); throw new DataImportHandlerException(DataImportHandlerException.WARN, e);

View File

@ -22,8 +22,8 @@ import java.io.Reader;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -45,7 +45,7 @@ import java.util.regex.Pattern;
* @since solr 1.3 * @since solr 1.3
*/ */
public class HttpDataSource extends DataSource<Reader> { public class HttpDataSource extends DataSource<Reader> {
Logger LOG = Logger.getLogger(HttpDataSource.class.getName()); Logger LOG = LoggerFactory.getLogger(HttpDataSource.class);
private String baseUrl; private String baseUrl;
@ -68,14 +68,14 @@ public class HttpDataSource extends DataSource<Reader> {
try { try {
connectionTimeout = Integer.parseInt(cTimeout); connectionTimeout = Integer.parseInt(cTimeout);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
LOG.log(Level.WARNING, "Invalid connection timeout: " + cTimeout); LOG.warn( "Invalid connection timeout: " + cTimeout);
} }
} }
if (rTimeout != null) { if (rTimeout != null) {
try { try {
readTimeout = Integer.parseInt(rTimeout); readTimeout = Integer.parseInt(rTimeout);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
LOG.log(Level.WARNING, "Invalid read timeout: " + rTimeout); LOG.warn( "Invalid read timeout: " + rTimeout);
} }
} }
@ -111,7 +111,7 @@ public class HttpDataSource extends DataSource<Reader> {
DataImporter.QUERY_COUNT.get().incrementAndGet(); DataImporter.QUERY_COUNT.get().incrementAndGet();
return new InputStreamReader(in, enc); return new InputStreamReader(in, enc);
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.SEVERE, "Exception thrown while getting data", e); LOG.error( "Exception thrown while getting data", e);
throw new DataImportHandlerException(DataImportHandlerException.SEVERE, throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
"Exception in invoking url " + url, e); "Exception in invoking url " + url, e);
} }

View File

@ -21,8 +21,8 @@ import org.apache.solr.common.SolrException;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -42,8 +42,7 @@ import java.util.logging.Logger;
*/ */
public class JdbcDataSource extends public class JdbcDataSource extends
DataSource<Iterator<Map<String, Object>>> { DataSource<Iterator<Map<String, Object>>> {
private static final Logger LOG = Logger.getLogger(JdbcDataSource.class private static final Logger LOG = LoggerFactory.getLogger(JdbcDataSource.class);
.getName());
private Callable<Connection> factory; private Callable<Connection> factory;
@ -71,7 +70,7 @@ public class JdbcDataSource extends
if (batchSize == -1) if (batchSize == -1)
batchSize = Integer.MIN_VALUE; batchSize = Integer.MIN_VALUE;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
LOG.log(Level.WARNING, "Invalid batch size: " + bsz); LOG.warn( "Invalid batch size: " + bsz);
} }
} }
@ -145,7 +144,7 @@ public class JdbcDataSource extends
} }
private void logError(String msg, Exception e) { private void logError(String msg, Exception e) {
LOG.log(Level.WARNING, msg, e); LOG.warn( msg, e);
} }
private List<String> readFieldNames(ResultSetMetaData metaData) private List<String> readFieldNames(ResultSetMetaData metaData)
@ -174,12 +173,12 @@ public class JdbcDataSource extends
stmt = c.createStatement(ResultSet.TYPE_FORWARD_ONLY, stmt = c.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY); ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(batchSize); stmt.setFetchSize(batchSize);
LOG.finer("Executing SQL: " + query); LOG.debug("Executing SQL: " + query);
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
if (stmt.execute(query)) { if (stmt.execute(query)) {
resultSet = stmt.getResultSet(); resultSet = stmt.getResultSet();
} }
LOG.finest("Time taken for sql :" LOG.trace("Time taken for sql :"
+ (System.currentTimeMillis() - start)); + (System.currentTimeMillis() - start));
colNames = readFieldNames(resultSet.getMetaData()); colNames = readFieldNames(resultSet.getMetaData());
} catch (Exception e) { } catch (Exception e) {

View File

@ -17,8 +17,8 @@
package org.apache.solr.handler.dataimport; package org.apache.solr.handler.dataimport;
import java.util.*; import java.util.*;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -40,8 +40,7 @@ import java.util.regex.Pattern;
* @since solr 1.3 * @since solr 1.3
*/ */
public class RegexTransformer extends Transformer { public class RegexTransformer extends Transformer {
private static final Logger LOG = Logger.getLogger(RegexTransformer.class private static final Logger LOG = LoggerFactory.getLogger(RegexTransformer.class);
.getName());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Map<String, Object> transformRow(Map<String, Object> row, public Map<String, Object> transformRow(Map<String, Object> row,
@ -112,8 +111,7 @@ public class RegexTransformer extends Transformer {
try { try {
l.add(m.group(i)); l.add(m.group(i));
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.WARNING, "Parsing failed for field : " + columnName, LOG.warn("Parsing failed for field : " + columnName, e);
e);
} }
} }
return l; return l;

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.solr.handler.dataimport; package org.apache.solr.handler.dataimport;
import org.apache.lucene.document.Document;
import org.apache.solr.update.AddUpdateCommand; import org.apache.solr.update.AddUpdateCommand;
import org.apache.solr.update.CommitUpdateCommand; import org.apache.solr.update.CommitUpdateCommand;
import org.apache.solr.update.DeleteUpdateCommand; import org.apache.solr.update.DeleteUpdateCommand;
@ -27,8 +26,8 @@ import java.io.*;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -42,8 +41,7 @@ import java.util.logging.Logger;
* @since solr 1.3 * @since solr 1.3
*/ */
public abstract class SolrWriter { public abstract class SolrWriter {
private static final Logger LOG = Logger private static final Logger log = LoggerFactory.getLogger(SolrWriter.class);
.getLogger(SolrWriter.class.getName());
static final String IMPORTER_PROPERTIES = "dataimport.properties"; static final String IMPORTER_PROPERTIES = "dataimport.properties";
@ -68,10 +66,10 @@ public abstract class SolrWriter {
command.overwriteCommitted = true; command.overwriteCommitted = true;
processor.processAdd(command); processor.processAdd(command);
} catch (IOException e) { } catch (IOException e) {
LOG.log(Level.SEVERE, "Exception while adding: " + d, e); log.error( "Exception while adding: " + d, e);
return false; return false;
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.WARNING, "Error creating document : " + d, e); log.warn( "Error creating document : " + d, e);
return false; return false;
} }
@ -80,14 +78,14 @@ public abstract class SolrWriter {
public void deleteDoc(Object id) { public void deleteDoc(Object id) {
try { try {
LOG.info("deleted from document to Solr: " + id); log.info("deleted from document to Solr: " + id);
DeleteUpdateCommand delCmd = new DeleteUpdateCommand(); DeleteUpdateCommand delCmd = new DeleteUpdateCommand();
delCmd.id = id.toString(); delCmd.id = id.toString();
delCmd.fromPending = true; delCmd.fromPending = true;
delCmd.fromCommitted = true; delCmd.fromCommitted = true;
processor.processDelete(delCmd); processor.processDelete(delCmd);
} catch (IOException e) { } catch (IOException e) {
LOG.log(Level.SEVERE, "Exception while deleteing: " + id, e); log.error( "Exception while deleteing: " + id, e);
} }
} }
@ -120,7 +118,7 @@ public abstract class SolrWriter {
filePath += SolrWriter.IMPORTER_PROPERTIES; filePath += SolrWriter.IMPORTER_PROPERTIES;
propOutput = new FileOutputStream(filePath); propOutput = new FileOutputStream(filePath);
props.store(propOutput, null); props.store(propOutput, null);
LOG.info("Wrote last indexed time to " + SolrWriter.IMPORTER_PROPERTIES); log.info("Wrote last indexed time to " + SolrWriter.IMPORTER_PROPERTIES);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new DataImportHandlerException(DataImportHandlerException.SEVERE, throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
"Unable to persist Index Start Time", e); "Unable to persist Index Start Time", e);
@ -145,10 +143,9 @@ public abstract class SolrWriter {
propInput = new FileInputStream(configDir propInput = new FileInputStream(configDir
+ SolrWriter.IMPORTER_PROPERTIES); + SolrWriter.IMPORTER_PROPERTIES);
props.load(propInput); props.load(propInput);
LOG.info("Read " + SolrWriter.IMPORTER_PROPERTIES); log.info("Read " + SolrWriter.IMPORTER_PROPERTIES);
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.WARNING, "Unable to read: " log.warn( "Unable to read: " + SolrWriter.IMPORTER_PROPERTIES);
+ SolrWriter.IMPORTER_PROPERTIES);
} finally { } finally {
try { try {
if (propInput != null) if (propInput != null)
@ -163,14 +160,14 @@ public abstract class SolrWriter {
public void deleteByQuery(String query) { public void deleteByQuery(String query) {
try { try {
LOG.info("Deleting documents from Solr with query: " + query); log.info("Deleting documents from Solr with query: " + query);
DeleteUpdateCommand delCmd = new DeleteUpdateCommand(); DeleteUpdateCommand delCmd = new DeleteUpdateCommand();
delCmd.query = query; delCmd.query = query;
delCmd.fromCommitted = true; delCmd.fromCommitted = true;
delCmd.fromPending = true; delCmd.fromPending = true;
processor.processDelete(delCmd); processor.processDelete(delCmd);
} catch (IOException e) { } catch (IOException e) {
LOG.log(Level.SEVERE, "Exception while deleting by query: " + query, e); log.error( "Exception while deleting by query: " + query, e);
} }
} }
@ -179,7 +176,7 @@ public abstract class SolrWriter {
CommitUpdateCommand commit = new CommitUpdateCommand(optimize); CommitUpdateCommand commit = new CommitUpdateCommand(optimize);
processor.processCommit(commit); processor.processCommit(commit);
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.SEVERE, "Exception while solr commit.", e); log.error( "Exception while solr commit.", e);
} }
} }

View File

@ -18,8 +18,8 @@ package org.apache.solr.handler.dataimport;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -42,8 +42,7 @@ import java.util.regex.Pattern;
* @since solr 1.3 * @since solr 1.3
*/ */
public class SqlEntityProcessor extends EntityProcessorBase { public class SqlEntityProcessor extends EntityProcessorBase {
private static final Logger LOG = Logger.getLogger(SqlEntityProcessor.class private static final Logger LOG = LoggerFactory.getLogger(SqlEntityProcessor.class);
.getName());
protected DataSource<Iterator<Map<String, Object>>> dataSource; protected DataSource<Iterator<Map<String, Object>>> dataSource;
@ -61,7 +60,7 @@ public class SqlEntityProcessor extends EntityProcessorBase {
} catch (DataImportHandlerException e) { } catch (DataImportHandlerException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.SEVERE, "The query failed '" + q + "'", e); LOG.error( "The query failed '" + q + "'", e);
throw new DataImportHandlerException(DataImportHandlerException.SEVERE, e); throw new DataImportHandlerException(DataImportHandlerException.SEVERE, e);
} }
} }

View File

@ -19,7 +19,8 @@ package org.apache.solr.handler.dataimport;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -47,8 +48,7 @@ import java.util.logging.Logger;
*/ */
public class TemplateTransformer extends Transformer { public class TemplateTransformer extends Transformer {
private static final Logger LOG = Logger.getLogger(TemplateTransformer.class private static final Logger LOG = LoggerFactory.getLogger(TemplateTransformer.class);
.getName());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Object transformRow(Map<String, Object> row, Context context) { public Object transformRow(Map<String, Object> row, Context context) {
@ -86,7 +86,7 @@ public class TemplateTransformer extends Transformer {
List<String> variables = TemplateString.getVariables(expr); List<String> variables = TemplateString.getVariables(expr);
for (String v : variables) { for (String v : variables) {
if (resolver.resolve(v) == null) { if (resolver.resolve(v) == null) {
LOG.warning("Unable to resolve variable: " + v LOG.warn("Unable to resolve variable: " + v
+ " while parsing expression: " + expr); + " while parsing expression: " + expr);
resolvable = false; resolvable = false;
} }

View File

@ -29,7 +29,8 @@ import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -51,8 +52,7 @@ import java.util.logging.Logger;
* @since solr 1.3 * @since solr 1.3
*/ */
public class XPathEntityProcessor extends EntityProcessorBase { public class XPathEntityProcessor extends EntityProcessorBase {
private static final Logger LOG = Logger.getLogger(XPathEntityProcessor.class private static final Logger LOG = LoggerFactory.getLogger(XPathEntityProcessor.class);
.getName());
protected List<String> placeHolderVariables; protected List<String> placeHolderVariables;

2
lib/slf4j-api-1.5.3.jar Normal file
View File

@ -0,0 +1,2 @@
AnyObjectId[01b3e7c893b3e24d40965a9776db0accfb5f0a72] was removed in git history.
Apache SVN contains full history.

View File

@ -0,0 +1,2 @@
AnyObjectId[15e3d442a23ce513d37d518be63e20d8618468bd] was removed in git history.
Apache SVN contains full history.

View File

@ -19,7 +19,8 @@ package org.apache.solr.analysis;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
@ -28,7 +29,7 @@ import java.util.logging.Logger;
* @version $Id$ * @version $Id$
*/ */
public abstract class BaseTokenFilterFactory implements TokenFilterFactory { public abstract class BaseTokenFilterFactory implements TokenFilterFactory {
final static Logger log = Logger.getLogger(BaseTokenFilterFactory.class.getName()); public static final Logger log = LoggerFactory.getLogger(BaseTokenFilterFactory.class);
/** The init args */ /** The init args */
protected Map<String,String> args; protected Map<String,String> args;

View File

@ -18,7 +18,8 @@
package org.apache.solr.analysis; package org.apache.solr.analysis;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
@ -27,7 +28,7 @@ import java.util.logging.Logger;
* @version $Id$ * @version $Id$
*/ */
public abstract class BaseTokenizerFactory implements TokenizerFactory { public abstract class BaseTokenizerFactory implements TokenizerFactory {
final static Logger log = Logger.getLogger(BaseTokenizerFactory.class.getName()); public static final Logger log = LoggerFactory.getLogger(BaseTokenizerFactory.class);
/** The init args */ /** The init args */
protected Map<String,String> args; protected Map<String,String> args;

View File

@ -17,7 +17,8 @@
package org.apache.solr.common; package org.apache.solr.common;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.CharArrayWriter; import java.io.CharArrayWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -129,14 +130,14 @@ public class SolrException extends RuntimeException {
public void log(Logger log) { log(log,this); } public void log(Logger log) { log(log,this); }
public static void log(Logger log, Throwable e) { public static void log(Logger log, Throwable e) {
log.severe(toStr(e)); log.error(toStr(e));
if (e instanceof SolrException) { if (e instanceof SolrException) {
((SolrException)e).logged = true; ((SolrException)e).logged = true;
} }
} }
public static void log(Logger log, String msg, Throwable e) { public static void log(Logger log, String msg, Throwable e) {
log.severe(msg + ':' + toStr(e)); log.error(msg + ':' + toStr(e));
if (e instanceof SolrException) { if (e instanceof SolrException) {
((SolrException)e).logged = true; ((SolrException)e).logged = true;
} }

View File

@ -62,7 +62,7 @@ public class StrUtils {
/*** /***
if (SolrCore.log.isLoggable(Level.FINEST)) { if (SolrCore.log.isLoggable(Level.FINEST)) {
SolrCore.log.finest("splitCommand=" + lst); SolrCore.log.trace("splitCommand=" + lst);
} }
***/ ***/

View File

@ -30,13 +30,14 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import java.io.*; import java.io.*;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* @version $Id$ * @version $Id$
*/ */
public class Config { public class Config {
public static final Logger log = Logger.getLogger(Config.class.getName()); public static final Logger log = LoggerFactory.getLogger(Config.class);
static final XPathFactory xpathFactory = XPathFactory.newInstance(); static final XPathFactory xpathFactory = XPathFactory.newInstance();
@ -170,12 +171,12 @@ public class Config {
if (errIfMissing) { if (errIfMissing) {
throw new RuntimeException(name + " missing "+path); throw new RuntimeException(name + " missing "+path);
} else { } else {
log.fine(name + " missing optional " + path); log.debug(name + " missing optional " + path);
return null; return null;
} }
} }
log.finest(name + ":" + path + "=" + nd); log.trace(name + ":" + path + "=" + nd);
return nd; return nd;
} catch (XPathExpressionException e) { } catch (XPathExpressionException e) {
@ -195,7 +196,7 @@ public class Config {
String txt = DOMUtil.getText(nd); String txt = DOMUtil.getText(nd);
log.fine(name + ' '+path+'='+txt); log.debug(name + ' '+path+'='+txt);
return txt; return txt;
/****** /******

View File

@ -26,7 +26,8 @@ import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathConstants;
@ -50,7 +51,7 @@ import org.xml.sax.SAXException;
*/ */
public class CoreContainer public class CoreContainer
{ {
protected static Logger log = Logger.getLogger(CoreContainer.class.getName()); protected static Logger log = LoggerFactory.getLogger(CoreContainer.class);
protected final Map<String, SolrCore> cores = new LinkedHashMap<String, SolrCore>(); protected final Map<String, SolrCore> cores = new LinkedHashMap<String, SolrCore>();
protected boolean persistent = false; protected boolean persistent = false;

View File

@ -27,8 +27,8 @@ import javax.management.remote.JMXServiceURL;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
* <p> * <p>
@ -46,7 +46,7 @@ import java.util.logging.Logger;
*/ */
public class JmxMonitoredMap<K, V> extends public class JmxMonitoredMap<K, V> extends
ConcurrentHashMap<String, SolrInfoMBean> { ConcurrentHashMap<String, SolrInfoMBean> {
private static final Logger LOG = Logger.getLogger(JmxMonitoredMap.class private static final Logger LOG = LoggerFactory.getLogger(JmxMonitoredMap.class
.getName()); .getName());
private MBeanServer server = null; private MBeanServer server = null;
@ -136,7 +136,7 @@ public class JmxMonitoredMap<K, V> extends
SolrDynamicMBean mbean = new SolrDynamicMBean(infoBean); SolrDynamicMBean mbean = new SolrDynamicMBean(infoBean);
server.registerMBean(mbean, name); server.registerMBean(mbean, name);
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.WARNING, "Failed to register info bean: " + key, e); LOG.warn( "Failed to register info bean: " + key, e);
} }
} }
@ -156,7 +156,7 @@ public class JmxMonitoredMap<K, V> extends
try { try {
unregister((String) key, infoBean); unregister((String) key, infoBean);
} catch (RuntimeException e) { } catch (RuntimeException e) {
LOG.log(Level.WARNING, "Failed to unregister info bean: " + key, e); LOG.warn( "Failed to unregister info bean: " + key, e);
} }
} }
return super.remove(key); return super.remove(key);
@ -231,7 +231,7 @@ public class JmxMonitoredMap<K, V> extends
} }
} }
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.WARNING, "Could not getStatistics on info bean " LOG.warn( "Could not getStatistics on info bean "
+ infoBean.getName(), e); + infoBean.getName(), e);
} }
@ -272,7 +272,7 @@ public class JmxMonitoredMap<K, V> extends
try { try {
list.add(new Attribute(attribute, getAttribute(attribute))); list.add(new Attribute(attribute, getAttribute(attribute)));
} catch (Exception e) { } catch (Exception e) {
LOG.warning("Could not get attibute " + attribute); LOG.warn("Could not get attibute " + attribute);
} }
} }

View File

@ -21,7 +21,8 @@ import java.net.URL;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathConstants;
@ -43,7 +44,7 @@ import org.w3c.dom.Node;
/** /**
*/ */
final class RequestHandlers { final class RequestHandlers {
public static Logger log = Logger.getLogger(RequestHandlers.class.getName()); public static Logger log = LoggerFactory.getLogger(RequestHandlers.class);
public static final String DEFAULT_HANDLER_NAME="standard"; public static final String DEFAULT_HANDLER_NAME="standard";
protected final SolrCore core; protected final SolrCore core;

View File

@ -25,7 +25,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level;
/** /**
*/ */
@ -66,9 +65,9 @@ class RunExecutableListener extends AbstractSolrEventListener {
int ret = 0; int ret = 0;
try { try {
boolean doLog = log.isLoggable(Level.FINE); boolean doLog = log.isDebugEnabled();
if (doLog) { if (doLog) {
log.fine("About to exec " + cmd[0]); log.debug("About to exec " + cmd[0]);
} }
Process proc = Runtime.getRuntime().exec(cmd, envp ,dir); Process proc = Runtime.getRuntime().exec(cmd, envp ,dir);
@ -81,7 +80,7 @@ class RunExecutableListener extends AbstractSolrEventListener {
} }
if (wait && doLog) { if (wait && doLog) {
log.fine("Executable " + cmd[0] + " returned " + ret); log.debug("Executable " + cmd[0] + " returned " + ret);
} }
} catch (IOException e) { } catch (IOException e) {

View File

@ -34,7 +34,6 @@ import javax.xml.parsers.ParserConfigurationException;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.io.IOException; import java.io.IOException;
@ -248,8 +247,7 @@ public class SolrConfig extends Config {
try { try {
return valueOf(s.toUpperCase()); return valueOf(s.toUpperCase());
} catch (Exception e) { } catch (Exception e) {
log.log(Level.WARNING, log.warn( "Unrecognized value for lastModFrom: " + s, e);
"Unrecognized value for lastModFrom: " + s, e);
return BOGUS; return BOGUS;
} }
} }
@ -282,10 +280,9 @@ public class SolrConfig extends Config {
? Long.valueOf(ttlStr) ? Long.valueOf(ttlStr)
: null; : null;
} catch (Exception e) { } catch (Exception e) {
log.log(Level.WARNING, log.warn( "Ignoring exception while attempting to " +
"Ignoring exception while attempting to " + "extract max-age from cacheControl config: " +
"extract max-age from cacheControl config: " + cacheControlHeader, e);
cacheControlHeader, e);
} }
} }
maxAge = tmp; maxAge = tmp;

View File

@ -63,7 +63,8 @@ import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URL; import java.net.URL;
@ -73,7 +74,7 @@ import java.net.URL;
public final class SolrCore implements SolrInfoMBean { public final class SolrCore implements SolrInfoMBean {
public static final String version="1.0"; public static final String version="1.0";
public static Logger log = Logger.getLogger(SolrCore.class.getName()); public static Logger log = LoggerFactory.getLogger(SolrCore.class);
private String name; private String name;
private String logid; // used to show what name is set private String logid; // used to show what name is set
@ -106,7 +107,7 @@ public final class SolrCore implements SolrInfoMBean {
boolean_query_max_clause_count = solrConfig.booleanQueryMaxClauseCount; boolean_query_max_clause_count = solrConfig.booleanQueryMaxClauseCount;
BooleanQuery.setMaxClauseCount(boolean_query_max_clause_count); BooleanQuery.setMaxClauseCount(boolean_query_max_clause_count);
} else if (boolean_query_max_clause_count != solrConfig.booleanQueryMaxClauseCount ) { } else if (boolean_query_max_clause_count != solrConfig.booleanQueryMaxClauseCount ) {
log.fine("BooleanQuery.maxClauseCount= " +boolean_query_max_clause_count+ ", ignoring " +solrConfig.booleanQueryMaxClauseCount); log.debug("BooleanQuery.maxClauseCount= " +boolean_query_max_clause_count+ ", ignoring " +solrConfig.booleanQueryMaxClauseCount);
} }
} }
} }
@ -284,14 +285,14 @@ public final class SolrCore implements SolrInfoMBean {
// if it didn't exist already... // if it didn't exist already...
Directory dir = SolrIndexWriter.getDirectory(getIndexDir(), solrConfig.mainIndexConfig); Directory dir = SolrIndexWriter.getDirectory(getIndexDir(), solrConfig.mainIndexConfig);
if (dir != null && IndexWriter.isLocked(dir)) { if (dir != null && IndexWriter.isLocked(dir)) {
log.warning(logid+"WARNING: Solr index directory '" + getIndexDir() + "' is locked. Unlocking..."); log.warn(logid+"WARNING: Solr index directory '" + getIndexDir() + "' is locked. Unlocking...");
IndexWriter.unlock(dir); IndexWriter.unlock(dir);
} }
} }
// Create the index if it doesn't exist. // Create the index if it doesn't exist.
if(!indexExists) { if(!indexExists) {
log.warning(logid+"Solr index directory '" + dirFile + "' doesn't exist." log.warn(logid+"Solr index directory '" + dirFile + "' doesn't exist."
+ " Creating new index..."); + " Creating new index...");
SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex",getIndexDir(), true, schema, solrConfig.mainIndexConfig); SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex",getIndexDir(), true, schema, solrConfig.mainIndexConfig);
@ -610,7 +611,7 @@ public final class SolrCore implements SolrInfoMBean {
if (count > 0) return; if (count > 0) return;
if (count < 0) { if (count < 0) {
//throw new RuntimeException("Too many closes on " + this); //throw new RuntimeException("Too many closes on " + this);
log.severe("Too many close {count:"+count+"} on " + this + ". Please report this exception to solr-user@lucene.apache.org"); log.error("Too many close {count:"+count+"} on " + this + ". Please report this exception to solr-user@lucene.apache.org");
return; return;
} }
log.info(logid+" CLOSING SolrCore " + this); log.info(logid+" CLOSING SolrCore " + this);
@ -653,7 +654,7 @@ public final class SolrCore implements SolrInfoMBean {
protected void finalize() { protected void finalize() {
if (getOpenCount() != 0) { if (getOpenCount() != 0) {
log.severe("REFCOUNT ERROR: unreferenced " + this + " (" + getName() + ") has a reference count of " + getOpenCount()); log.error("REFCOUNT ERROR: unreferenced " + this + " (" + getName() + ") has a reference count of " + getOpenCount());
} }
} }
@ -931,12 +932,12 @@ public final class SolrCore implements SolrInfoMBean {
onDeckSearchers++; onDeckSearchers++;
if (onDeckSearchers < 1) { if (onDeckSearchers < 1) {
// should never happen... just a sanity check // should never happen... just a sanity check
log.severe(logid+"ERROR!!! onDeckSearchers is " + onDeckSearchers); log.error(logid+"ERROR!!! onDeckSearchers is " + onDeckSearchers);
onDeckSearchers=1; // reset onDeckSearchers=1; // reset
} else if (onDeckSearchers > maxWarmingSearchers) { } else if (onDeckSearchers > maxWarmingSearchers) {
onDeckSearchers--; onDeckSearchers--;
String msg="Error opening new searcher. exceeded limit of maxWarmingSearchers="+maxWarmingSearchers + ", try again later."; String msg="Error opening new searcher. exceeded limit of maxWarmingSearchers="+maxWarmingSearchers + ", try again later.";
log.warning(logid+""+ msg); log.warn(logid+""+ msg);
// HTTP 503==service unavailable, or 409==Conflict // HTTP 503==service unavailable, or 409==Conflict
throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,msg,true); throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,msg,true);
} else if (onDeckSearchers > 1) { } else if (onDeckSearchers > 1) {
@ -1121,7 +1122,7 @@ public final class SolrCore implements SolrInfoMBean {
} }
if (onDeckSearchers < 0) { if (onDeckSearchers < 0) {
// sanity check... should never happen // sanity check... should never happen
log.severe(logid+"ERROR!!! onDeckSearchers after decrement=" + onDeckSearchers); log.error(logid+"ERROR!!! onDeckSearchers after decrement=" + onDeckSearchers);
onDeckSearchers=0; // try and recover onDeckSearchers=0; // try and recover
} }
// if we failed, we need to wake up at least one waiter to continue the process // if we failed, we need to wake up at least one waiter to continue the process
@ -1151,7 +1152,7 @@ public final class SolrCore implements SolrInfoMBean {
} }
resource.close(); resource.close();
} catch (IOException e) { } catch (IOException e) {
log.severe("Error closing searcher:" + SolrException.toStr(e)); log.error("Error closing searcher:" + SolrException.toStr(e));
} }
} }
}; };
@ -1208,7 +1209,7 @@ public final class SolrCore implements SolrInfoMBean {
public void execute(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) { public void execute(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) {
if (handler==null) { if (handler==null) {
log.warning(logid+"Null Request Handler '" + req.getQueryType() +"' :" + req); log.warn(logid+"Null Request Handler '" + req.getQueryType() +"' :" + req);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Null Request Handler '" + req.getQueryType() + "'", true); throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Null Request Handler '" + req.getQueryType() + "'", true);
} }
// setup response header and handle request // setup response header and handle request
@ -1240,7 +1241,7 @@ public final class SolrCore implements SolrInfoMBean {
public void execute(SolrQueryRequest req, SolrQueryResponse rsp) { public void execute(SolrQueryRequest req, SolrQueryResponse rsp) {
SolrRequestHandler handler = getRequestHandler(req.getQueryType()); SolrRequestHandler handler = getRequestHandler(req.getQueryType());
if (handler==null) { if (handler==null) {
log.warning(logid+"Unknown Request Handler '" + req.getQueryType() +"' :" + req); log.warn(logid+"Unknown Request Handler '" + req.getQueryType() +"' :" + req);
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + req.getQueryType() + "'", true); throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + req.getQueryType() + "'", true);
} }
execute(handler, req, rsp); execute(handler, req, rsp);
@ -1414,7 +1415,7 @@ public final class SolrCore implements SolrInfoMBean {
// TODO -- this should be removed in deprecation release... // TODO -- this should be removed in deprecation release...
String gettable = solrConfig.get("admin/gettableFiles", null ); String gettable = solrConfig.get("admin/gettableFiles", null );
if( gettable != null ) { if( gettable != null ) {
log.warning( log.warn(
"solrconfig.xml uses deprecated <admin/gettableFiles>, Please "+ "solrconfig.xml uses deprecated <admin/gettableFiles>, Please "+
"update your config to use the ShowFileRequestHandler." ); "update your config to use the ShowFileRequestHandler." );
if( getRequestHandler( "/admin/file" ) == null ) { if( getRequestHandler( "/admin/file" ) == null ) {
@ -1442,7 +1443,7 @@ public final class SolrCore implements SolrInfoMBean {
handler.init( args ); handler.init( args );
reqHandlers.register("/admin/file", handler); reqHandlers.register("/admin/file", handler);
log.warning( "adding ShowFileRequestHandler with hidden files: "+hide ); log.warn( "adding ShowFileRequestHandler with hidden files: "+hide );
} }
} }
} }

View File

@ -20,13 +20,14 @@ package org.apache.solr.core;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
import org.apache.solr.search.SolrIndexSearcher; import org.apache.solr.search.SolrIndexSearcher;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* @version $Id$ * @version $Id$
*/ */
public interface SolrEventListener { public interface SolrEventListener {
static final Logger log = Logger.getLogger(SolrCore.class.getName()); static final Logger log = LoggerFactory.getLogger(SolrCore.class);
public void init(NamedList args); public void init(NamedList args);

View File

@ -28,7 +28,8 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import javax.naming.Context; import javax.naming.Context;
@ -54,7 +55,7 @@ import org.apache.solr.spelling.SpellingQueryConverter;
*/ */
public class SolrResourceLoader implements ResourceLoader public class SolrResourceLoader implements ResourceLoader
{ {
public static final Logger log = Logger.getLogger(SolrResourceLoader.class.getName()); public static final Logger log = LoggerFactory.getLogger(SolrResourceLoader.class);
static final String project = "solr"; static final String project = "solr";
static final String base = "org.apache" + "." + project; static final String base = "org.apache" + "." + project;
@ -263,7 +264,7 @@ public class SolrResourceLoader implements ResourceLoader
for (String subpackage : subpackages) { for (String subpackage : subpackages) {
try { try {
String name = base + '.' + subpackage + newName; String name = base + '.' + subpackage + newName;
log.finest("Trying class name " + name); log.trace("Trying class name " + name);
return Class.forName(name, true, classLoader); return Class.forName(name, true, classLoader);
} catch (ClassNotFoundException e1) { } catch (ClassNotFoundException e1) {
// ignore... assume first exception is best. // ignore... assume first exception is best.
@ -354,7 +355,7 @@ public class SolrResourceLoader implements ResourceLoader
} catch (NamingException e) { } catch (NamingException e) {
log.info("No /"+project+"/home in JNDI"); log.info("No /"+project+"/home in JNDI");
} catch( RuntimeException ex ) { } catch( RuntimeException ex ) {
log.warning("Odd RuntimeException while testing for JNDI: " + ex.getMessage()); log.warn("Odd RuntimeException while testing for JNDI: " + ex.getMessage());
} }
// Now try system property // Now try system property

View File

@ -43,7 +43,8 @@ import java.io.StringReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@ -51,7 +52,7 @@ import java.util.logging.Logger;
**/ **/
public class AnalysisRequestHandler extends RequestHandlerBase { public class AnalysisRequestHandler extends RequestHandlerBase {
public static Logger log = Logger.getLogger(AnalysisRequestHandler.class.getName()); public static Logger log = LoggerFactory.getLogger(AnalysisRequestHandler.class);
private XMLInputFactory inputFactory; private XMLInputFactory inputFactory;
@ -72,7 +73,7 @@ public class AnalysisRequestHandler extends RequestHandlerBase {
catch (IllegalArgumentException ex) { catch (IllegalArgumentException ex) {
// Other implementations will likely throw this exception since "reuse-instance" // Other implementations will likely throw this exception since "reuse-instance"
// isimplementation specific. // isimplementation specific.
log.fine("Unable to set the 'reuse-instance' property for the input factory: " + inputFactory); log.debug("Unable to set the 'reuse-instance' property for the input factory: " + inputFactory);
} }
} }
@ -107,7 +108,7 @@ public class AnalysisRequestHandler extends RequestHandlerBase {
case XMLStreamConstants.START_ELEMENT: { case XMLStreamConstants.START_ELEMENT: {
String currTag = parser.getLocalName(); String currTag = parser.getLocalName();
if ("doc".equals(currTag)) { if ("doc".equals(currTag)) {
log.finest("Tokenizing doc..."); log.trace("Tokenizing doc...");
SolrInputDocument doc = readDoc(parser); SolrInputDocument doc = readDoc(parser);
SchemaField uniq = schema.getUniqueKeyField(); SchemaField uniq = schema.getUniqueKeyField();
@ -181,7 +182,7 @@ public class AnalysisRequestHandler extends RequestHandlerBase {
text.setLength(0); text.setLength(0);
String localName = parser.getLocalName(); String localName = parser.getLocalName();
if (!"field".equals(localName)) { if (!"field".equals(localName)) {
log.warning("unexpected XML tag doc/" + localName); log.warn("unexpected XML tag doc/" + localName);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"unexpected XML tag doc/" + localName); "unexpected XML tag doc/" + localName);
} }

View File

@ -39,7 +39,8 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Takes a string (e.g. a query string) as the value of the "q" parameter * Takes a string (e.g. a query string) as the value of the "q" parameter
@ -196,7 +197,7 @@ pre.code
@Deprecated @Deprecated
public class SpellCheckerRequestHandler extends RequestHandlerBase implements SolrCoreAware { public class SpellCheckerRequestHandler extends RequestHandlerBase implements SolrCoreAware {
private static Logger log = Logger.getLogger(SpellCheckerRequestHandler.class.getName()); private static Logger log = LoggerFactory.getLogger(SpellCheckerRequestHandler.class);
private SpellChecker spellChecker; private SpellChecker spellChecker;

View File

@ -22,7 +22,8 @@ import java.io.Reader;
import java.io.Writer; import java.io.Writer;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javanet.staxutils.BaseXMLInputFactory; import javanet.staxutils.BaseXMLInputFactory;
@ -58,7 +59,7 @@ import org.apache.solr.update.processor.UpdateRequestProcessor;
*/ */
public class XmlUpdateRequestHandler extends RequestHandlerBase public class XmlUpdateRequestHandler extends RequestHandlerBase
{ {
public static Logger log = Logger.getLogger(XmlUpdateRequestHandler.class.getName()); public static Logger log = LoggerFactory.getLogger(XmlUpdateRequestHandler.class);
public static final String UPDATE_PROCESSOR = "update.processor"; public static final String UPDATE_PROCESSOR = "update.processor";
@ -96,7 +97,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
catch( IllegalArgumentException ex ) { catch( IllegalArgumentException ex ) {
// Other implementations will likely throw this exception since "reuse-instance" // Other implementations will likely throw this exception since "reuse-instance"
// isimplementation specific. // isimplementation specific.
log.fine( "Unable to set the 'reuse-instance' property for the input chain: "+inputFactory ); log.debug( "Unable to set the 'reuse-instance' property for the input chain: "+inputFactory );
} }
} }
@ -154,7 +155,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
case XMLStreamConstants.START_ELEMENT: case XMLStreamConstants.START_ELEMENT:
String currTag = parser.getLocalName(); String currTag = parser.getLocalName();
if (currTag.equals(ADD)) { if (currTag.equals(ADD)) {
log.finest("SolrCore.update(add)"); log.trace("SolrCore.update(add)");
addCmd = new AddUpdateCommand(); addCmd = new AddUpdateCommand();
boolean overwrite=true; // the default boolean overwrite=true; // the default
@ -173,7 +174,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if ( OVERWRITE_COMMITTED.equals(attrName) ) { } else if ( OVERWRITE_COMMITTED.equals(attrName) ) {
overwriteCommitted = StrUtils.parseBoolean(attrVal); overwriteCommitted = StrUtils.parseBoolean(attrVal);
} else { } else {
log.warning("Unknown attribute id in add:" + attrName); log.warn("Unknown attribute id in add:" + attrName);
} }
} }
@ -190,13 +191,13 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
addCmd.allowDups = !overwrite; addCmd.allowDups = !overwrite;
} }
else if ("doc".equals(currTag)) { else if ("doc".equals(currTag)) {
log.finest("adding doc..."); log.trace("adding doc...");
addCmd.clear(); addCmd.clear();
addCmd.solrDoc = readDoc( parser ); addCmd.solrDoc = readDoc( parser );
processor.processAdd(addCmd); processor.processAdd(addCmd);
} }
else if ( COMMIT.equals(currTag) || OPTIMIZE.equals(currTag)) { else if ( COMMIT.equals(currTag) || OPTIMIZE.equals(currTag)) {
log.finest("parsing " + currTag); log.trace("parsing " + currTag);
CommitUpdateCommand cmd = new CommitUpdateCommand(OPTIMIZE.equals(currTag)); CommitUpdateCommand cmd = new CommitUpdateCommand(OPTIMIZE.equals(currTag));
@ -214,7 +215,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
cmd.maxOptimizeSegments = Integer.parseInt(attrVal); cmd.maxOptimizeSegments = Integer.parseInt(attrVal);
} }
else { else {
log.warning("unexpected attribute commit/@" + attrName); log.warn("unexpected attribute commit/@" + attrName);
} }
} }
@ -226,7 +227,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
processor.processCommit( cmd ); processor.processCommit( cmd );
} // end commit } // end commit
else if (DELETE.equals(currTag)) { else if (DELETE.equals(currTag)) {
log.finest("parsing delete"); log.trace("parsing delete");
processDelete( processor, parser); processDelete( processor, parser);
} // end delete } // end delete
break; break;
@ -251,7 +252,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if ("fromCommitted".equals(attrName)) { } else if ("fromCommitted".equals(attrName)) {
deleteCmd.fromCommitted = StrUtils.parseBoolean(attrVal); deleteCmd.fromCommitted = StrUtils.parseBoolean(attrVal);
} else { } else {
log.warning("unexpected attribute delete/@" + attrName); log.warn("unexpected attribute delete/@" + attrName);
} }
} }
@ -262,7 +263,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
case XMLStreamConstants.START_ELEMENT: case XMLStreamConstants.START_ELEMENT:
String mode = parser.getLocalName(); String mode = parser.getLocalName();
if (!("id".equals(mode) || "query".equals(mode))) { if (!("id".equals(mode) || "query".equals(mode))) {
log.warning("unexpected XML tag /delete/" + mode); log.warn("unexpected XML tag /delete/" + mode);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"unexpected XML tag /delete/" + mode); "unexpected XML tag /delete/" + mode);
} }
@ -278,7 +279,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if( "delete".equals( currTag ) ) { } else if( "delete".equals( currTag ) ) {
return; return;
} else { } else {
log.warning("unexpected XML tag /delete/" + currTag); log.warn("unexpected XML tag /delete/" + currTag);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"unexpected XML tag /delete/" + currTag); "unexpected XML tag /delete/" + currTag);
} }
@ -309,7 +310,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
if ("boost".equals(attrName)) { if ("boost".equals(attrName)) {
doc.setDocumentBoost( Float.parseFloat(parser.getAttributeValue(i)) ); doc.setDocumentBoost( Float.parseFloat(parser.getAttributeValue(i)) );
} else { } else {
log.warning("Unknown attribute doc/@" + attrName); log.warn("Unknown attribute doc/@" + attrName);
} }
} }
@ -343,7 +344,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
text.setLength(0); text.setLength(0);
String localName = parser.getLocalName(); String localName = parser.getLocalName();
if (!"field".equals(localName)) { if (!"field".equals(localName)) {
log.warning("unexpected XML tag doc/" + localName); log.warn("unexpected XML tag doc/" + localName);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"unexpected XML tag doc/" + localName); "unexpected XML tag doc/" + localName);
} }
@ -359,7 +360,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if ("null".equals(attrName)) { } else if ("null".equals(attrName)) {
isNull = StrUtils.parseBoolean(attrVal); isNull = StrUtils.parseBoolean(attrVal);
} else { } else {
log.warning("Unknown attribute doc/field/@" + attrName); log.warn("Unknown attribute doc/field/@" + attrName);
} }
} }
break; break;
@ -399,7 +400,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
SolrException.logOnce(log, "Error processing \"legacy\" update command", ex); SolrException.logOnce(log, "Error processing \"legacy\" update command", ex);
XML.writeXML(output, "result", SolrException.toStr(ex), "status", "1"); XML.writeXML(output, "result", SolrException.toStr(ex), "status", "1");
} catch (Exception ee) { } catch (Exception ee) {
log.severe("Error writing to output stream: " + ee); log.error("Error writing to output stream: " + ee);
} }
} }
} }

View File

@ -29,8 +29,8 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
@ -82,7 +82,7 @@ import org.apache.solr.search.SolrQueryParser;
*/ */
public class LukeRequestHandler extends RequestHandlerBase public class LukeRequestHandler extends RequestHandlerBase
{ {
private static Logger log = Logger.getLogger(LukeRequestHandler.class.getName()); private static Logger log = LoggerFactory.getLogger(LukeRequestHandler.class);
public static final String NUMTERMS = "numTerms"; public static final String NUMTERMS = "numTerms";
public static final String DOC_ID = "docId"; public static final String DOC_ID = "docId";
@ -261,7 +261,7 @@ public class LukeRequestHandler extends RequestHandlerBase
} }
} }
catch( Exception ex ) { catch( Exception ex ) {
log.log( Level.WARNING, "error writing term vector", ex ); log.warn( "error writing term vector", ex );
} }
} }
@ -322,7 +322,7 @@ public class LukeRequestHandler extends RequestHandlerBase
} }
} }
catch( Exception ex ) { catch( Exception ex ) {
log.warning( "error reading field: "+fieldName ); log.warn( "error reading field: "+fieldName );
} }
// Find one document so we can get the fieldable // Find one document so we can get the fieldable
} }

View File

@ -29,7 +29,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.xpath.XPath; import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathConstants;
@ -77,7 +78,7 @@ import org.w3c.dom.NodeList;
*/ */
public class QueryElevationComponent extends SearchComponent implements SolrCoreAware public class QueryElevationComponent extends SearchComponent implements SolrCoreAware
{ {
private static Logger log = Logger.getLogger(QueryElevationComponent.class.getName()); private static Logger log = LoggerFactory.getLogger(QueryElevationComponent.class);
// Constants used in solrconfig.xml // Constants used in solrconfig.xml
static final String FIELD_TYPE = "queryFieldType"; static final String FIELD_TYPE = "queryFieldType";

View File

@ -39,7 +39,8 @@ import org.apache.lucene.queryParser.ParseException;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpClient;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
@ -54,7 +55,7 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
static final String INIT_FIRST_COMPONENTS = "first-components"; static final String INIT_FIRST_COMPONENTS = "first-components";
static final String INIT_LAST_COMPONENTS = "last-components"; static final String INIT_LAST_COMPONENTS = "last-components";
protected static Logger log = Logger.getLogger(SearchHandler.class.getName()); protected static Logger log = LoggerFactory.getLogger(SearchHandler.class);
protected List<SearchComponent> components = null; protected List<SearchComponent> components = null;
@ -133,7 +134,7 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception, ParseException, InstantiationException, IllegalAccessException public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception, ParseException, InstantiationException, IllegalAccessException
{ {
// int sleep = req.getParams().getInt("sleep",0); // int sleep = req.getParams().getInt("sleep",0);
// if (sleep > 0) {log.severe("SLEEPING for " + sleep); Thread.sleep(sleep);} // if (sleep > 0) {log.error("SLEEPING for " + sleep); Thread.sleep(sleep);}
ResponseBuilder rb = new ResponseBuilder(); ResponseBuilder rb = new ResponseBuilder();
rb.req = req; rb.req = req;
rb.rsp = rsp; rb.rsp = rsp;

View File

@ -27,8 +27,8 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Collections; import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathConstants;
@ -67,7 +67,7 @@ import org.w3c.dom.NodeList;
* @since solr 1.3 * @since solr 1.3
*/ */
public class SpellCheckComponent extends SearchComponent implements SolrCoreAware, SpellingParams { public class SpellCheckComponent extends SearchComponent implements SolrCoreAware, SpellingParams {
private static final Logger LOG = Logger.getLogger(SpellCheckComponent.class.getName()); private static final Logger LOG = LoggerFactory.getLogger(SpellCheckComponent.class);
public static final boolean DEFAULT_ONLY_MORE_POPULAR = false; public static final boolean DEFAULT_ONLY_MORE_POPULAR = false;
@ -235,7 +235,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
} }
String collVal = collation.toString(); String collVal = collation.toString();
if (collVal.equals(origQuery) == false) { if (collVal.equals(origQuery) == false) {
LOG.fine("Collation:" + collation); LOG.debug("Collation:" + collation);
result.add("collation", collVal); result.add("collation", collVal);
} }
} }
@ -295,7 +295,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
//ensure that there is at least one query converter defined //ensure that there is at least one query converter defined
if (queryConverters.size() == 0) { if (queryConverters.size() == 0) {
LOG.warning("No queryConverter defined, using default converter"); LOG.warn("No queryConverter defined, using default converter");
queryConverters.put("queryConverter", new SpellingQueryConverter()); queryConverters.put("queryConverter", new SpellingQueryConverter());
} }
@ -335,7 +335,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
+ checker.getDictionaryName()); + checker.getDictionaryName());
checker.reload(); checker.reload();
} catch (IOException e) { } catch (IOException e) {
LOG.log(Level.SEVERE, "Exception in reloading spell check index for spellchecker: " + checker.getDictionaryName(), e); log.error( "Exception in reloading spell check index for spellchecker: " + checker.getDictionaryName(), e);
} }
} else { } else {
// newSearcher event // newSearcher event
@ -343,7 +343,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
LOG.info("Building spell index for spell checker: " + checker.getDictionaryName()); LOG.info("Building spell index for spell checker: " + checker.getDictionaryName());
checker.build(core, newSearcher); checker.build(core, newSearcher);
} catch (Exception e) { } catch (Exception e) {
LOG.log(Level.SEVERE, log.error(
"Exception in building spell check index for spellchecker: " + checker.getDictionaryName(), e); "Exception in building spell check index for spellchecker: " + checker.getDictionaryName(), e);
} }
} }
@ -369,17 +369,17 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
@Override @Override
public String getVersion() { public String getVersion() {
return "$Revision:$"; return "$Revision$";
} }
@Override @Override
public String getSourceId() { public String getSourceId() {
return "$Id:$"; return "$Id$";
} }
@Override @Override
public String getSource() { public String getSource() {
return "$URL:$"; return "$URL$";
} }
} }

View File

@ -20,7 +20,8 @@ import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.solr.common.params.HighlightParams; import org.apache.solr.common.params.HighlightParams;
@ -33,7 +34,7 @@ import org.apache.solr.util.SolrPluginUtils;
public abstract class SolrHighlighter public abstract class SolrHighlighter
{ {
public static Logger log = Logger.getLogger(SolrHighlighter.class.getName()); public static Logger log = LoggerFactory.getLogger(SolrHighlighter.class);
// Thread safe registry // Thread safe registry
protected final Map<String,SolrFormatter> formatters = protected final Map<String,SolrFormatter> formatters =

View File

@ -24,7 +24,8 @@ import java.io.IOException;
import java.io.Reader; import java.io.Reader;
import java.io.Writer; import java.io.Writer;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerException;
@ -50,7 +51,7 @@ public class XSLTResponseWriter implements QueryResponseWriter {
public static final int XSLT_CACHE_DEFAULT = 60; public static final int XSLT_CACHE_DEFAULT = 60;
private static final String XSLT_CACHE_PARAM = "xsltCacheLifetimeSeconds"; private static final String XSLT_CACHE_PARAM = "xsltCacheLifetimeSeconds";
private static final Logger log = Logger.getLogger(XSLTResponseWriter.class.getName()); private static final Logger log = LoggerFactory.getLogger(XSLTResponseWriter.class);
public void init(NamedList n) { public void init(NamedList n) {
final SolrParams p = SolrParams.toSolrParams(n); final SolrParams p = SolrParams.toSolrParams(n);

View File

@ -33,7 +33,8 @@ import org.apache.solr.request.TextResponseWriter;
import org.apache.solr.analysis.SolrAnalyzer; import org.apache.solr.analysis.SolrAnalyzer;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.io.Reader; import java.io.Reader;
@ -45,7 +46,7 @@ import java.io.IOException;
* @version $Id$ * @version $Id$
*/ */
public abstract class FieldType extends FieldProperties { public abstract class FieldType extends FieldProperties {
public static final Logger log = Logger.getLogger(FieldType.class.getName()); public static final Logger log = LoggerFactory.getLogger(FieldType.class);
/** The name of the type (not the name of the field) */ /** The name of the type (not the name of the field) */
protected String typeName; protected String typeName;
@ -182,7 +183,7 @@ public abstract class FieldType extends FieldProperties {
} }
if (val==null) return null; if (val==null) return null;
if (!field.indexed() && !field.stored()) { if (!field.indexed() && !field.stored()) {
log.finest("Ignoring unindexed/unstored field: " + field); log.trace("Ignoring unindexed/unstored field: " + field);
return null; return null;
} }
@ -364,7 +365,7 @@ public abstract class FieldType extends FieldProperties {
*/ */
public void setAnalyzer(Analyzer analyzer) { public void setAnalyzer(Analyzer analyzer) {
this.analyzer = analyzer; this.analyzer = analyzer;
log.finest("FieldType: " + typeName + ".setAnalyzer(" + analyzer.getClass().getName() + ")" ); log.trace("FieldType: " + typeName + ".setAnalyzer(" + analyzer.getClass().getName() + ")" );
} }
/** /**
@ -373,7 +374,7 @@ public abstract class FieldType extends FieldProperties {
*/ */
public void setQueryAnalyzer(Analyzer analyzer) { public void setQueryAnalyzer(Analyzer analyzer) {
this.queryAnalyzer = analyzer; this.queryAnalyzer = analyzer;
log.finest("FieldType: " + typeName + ".setQueryAnalyzer(" + analyzer.getClass().getName() + ")" ); log.trace("FieldType: " + typeName + ".setQueryAnalyzer(" + analyzer.getClass().getName() + ")" );
} }
/** /**

View File

@ -45,7 +45,8 @@ import java.io.InputStream;
import java.io.Reader; import java.io.Reader;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* <code>IndexSchema</code> contains information about the valid fields in an index * <code>IndexSchema</code> contains information about the valid fields in an index
@ -56,7 +57,7 @@ import java.util.logging.Logger;
public final class IndexSchema { public final class IndexSchema {
public static final String DEFAULT_SCHEMA_FILE = "schema.xml"; public static final String DEFAULT_SCHEMA_FILE = "schema.xml";
final static Logger log = Logger.getLogger(IndexSchema.class.getName()); final static Logger log = LoggerFactory.getLogger(IndexSchema.class);
private final SolrConfig solrConfig; private final SolrConfig solrConfig;
private final String resourceName; private final String resourceName;
private String name; private String name;
@ -386,7 +387,7 @@ public final class IndexSchema {
Node nd = (Node) xpath.evaluate("/schema/@name", document, XPathConstants.NODE); Node nd = (Node) xpath.evaluate("/schema/@name", document, XPathConstants.NODE);
if (nd==null) { if (nd==null) {
log.warning("schema has no name!"); log.warn("schema has no name!");
} else { } else {
name = nd.getNodeValue(); name = nd.getNodeValue();
log.info("Schema name=" + name); log.info("Schema name=" + name);
@ -429,7 +430,7 @@ public final class IndexSchema {
@Override @Override
protected FieldType register(String name, FieldType plugin) throws Exception { protected FieldType register(String name, FieldType plugin) throws Exception {
log.finest("fieldtype defined: " + plugin ); log.trace("fieldtype defined: " + plugin );
return fieldTypes.put( name, plugin ); return fieldTypes.put( name, plugin );
} }
}; };
@ -453,7 +454,7 @@ public final class IndexSchema {
NamedNodeMap attrs = node.getAttributes(); NamedNodeMap attrs = node.getAttributes();
String name = DOMUtil.getAttr(attrs,"name","field definition"); String name = DOMUtil.getAttr(attrs,"name","field definition");
log.finest("reading field def "+name); log.trace("reading field def "+name);
String type = DOMUtil.getAttr(attrs,"type","field " + name); String type = DOMUtil.getAttr(attrs,"type","field " + name);
FieldType ft = fieldTypes.get(type); FieldType ft = fieldTypes.get(type);
@ -479,13 +480,13 @@ public final class IndexSchema {
SolrConfig.severeErrors.add( t ); SolrConfig.severeErrors.add( t );
} }
log.fine("field defined: " + f); log.debug("field defined: " + f);
if( f.getDefaultValue() != null ) { if( f.getDefaultValue() != null ) {
log.fine(name+" contains default value: " + f.getDefaultValue()); log.debug(name+" contains default value: " + f.getDefaultValue());
fieldsWithDefaultValue.add( f ); fieldsWithDefaultValue.add( f );
} }
if (f.isRequired()) { if (f.isRequired()) {
log.fine(name+" is required in this schema"); log.debug(name+" is required in this schema");
requiredFields.add(f); requiredFields.add(f);
} }
} else if (node.getNodeName().equals("dynamicField")) { } else if (node.getNodeName().equals("dynamicField")) {
@ -505,7 +506,7 @@ public final class IndexSchema {
} }
if( !dup ) { if( !dup ) {
dFields.add(new DynamicField(f)); dFields.add(new DynamicField(f));
log.fine("dynamic field defined: " + f); log.debug("dynamic field defined: " + f);
} }
} else { } else {
// we should never get here // we should never get here
@ -523,7 +524,7 @@ public final class IndexSchema {
// the largest string possible. // the largest string possible.
Collections.sort(dFields); Collections.sort(dFields);
log.finest("Dynamic Field Ordering:" + dFields); log.trace("Dynamic Field Ordering:" + dFields);
// stuff it in a normal array for faster access // stuff it in a normal array for faster access
dynamicFields = (DynamicField[])dFields.toArray(new DynamicField[dFields.size()]); dynamicFields = (DynamicField[])dFields.toArray(new DynamicField[dFields.size()]);
@ -536,7 +537,7 @@ public final class IndexSchema {
return Similarity.getDefault(); return Similarity.getDefault();
} }
}; };
log.fine("using default similarity"); log.debug("using default similarity");
} else { } else {
final Object obj = solrConfig.getResourceLoader().newInstance(((Element) node).getAttribute("class")); final Object obj = solrConfig.getResourceLoader().newInstance(((Element) node).getAttribute("class"));
if (obj instanceof SimilarityFactory) { if (obj instanceof SimilarityFactory) {
@ -552,12 +553,12 @@ public final class IndexSchema {
} }
}; };
} }
log.fine("using similarity factory" + similarityFactory.getClass().getName()); log.debug("using similarity factory" + similarityFactory.getClass().getName());
} }
node = (Node) xpath.evaluate("/schema/defaultSearchField/text()", document, XPathConstants.NODE); node = (Node) xpath.evaluate("/schema/defaultSearchField/text()", document, XPathConstants.NODE);
if (node==null) { if (node==null) {
log.warning("no default search field specified in schema."); log.warn("no default search field specified in schema.");
} else { } else {
defaultSearchFieldName=node.getNodeValue().trim(); defaultSearchFieldName=node.getNodeValue().trim();
// throw exception if specified, but not found or not indexed // throw exception if specified, but not found or not indexed
@ -573,7 +574,7 @@ public final class IndexSchema {
node = (Node) xpath.evaluate("/schema/solrQueryParser/@defaultOperator", document, XPathConstants.NODE); node = (Node) xpath.evaluate("/schema/solrQueryParser/@defaultOperator", document, XPathConstants.NODE);
if (node==null) { if (node==null) {
log.fine("using default query parser operator (OR)"); log.debug("using default query parser operator (OR)");
} else { } else {
queryParserDefaultOperator=node.getNodeValue().trim(); queryParserDefaultOperator=node.getNodeValue().trim();
log.info("query parser default operator is "+queryParserDefaultOperator); log.info("query parser default operator is "+queryParserDefaultOperator);
@ -581,7 +582,7 @@ public final class IndexSchema {
node = (Node) xpath.evaluate("/schema/uniqueKey/text()", document, XPathConstants.NODE); node = (Node) xpath.evaluate("/schema/uniqueKey/text()", document, XPathConstants.NODE);
if (node==null) { if (node==null) {
log.warning("no uniqueKey specified in schema."); log.warn("no uniqueKey specified in schema.");
} else { } else {
uniqueKeyField=getIndexedField(node.getNodeValue().trim()); uniqueKeyField=getIndexedField(node.getNodeValue().trim());
uniqueKeyFieldName=uniqueKeyField.getName(); uniqueKeyFieldName=uniqueKeyField.getName();
@ -615,7 +616,7 @@ public final class IndexSchema {
for (Map.Entry<SchemaField, Integer> entry : copyFieldTargetCounts.entrySet()) { for (Map.Entry<SchemaField, Integer> entry : copyFieldTargetCounts.entrySet()) {
if (entry.getValue() > 1 && !entry.getKey().multiValued()) { if (entry.getValue() > 1 && !entry.getKey().multiValued()) {
log.warning("Field " + entry.getKey().name + " is not multivalued "+ log.warn("Field " + entry.getKey().name + " is not multivalued "+
"and destination for multiple copyFields ("+ "and destination for multiple copyFields ("+
entry.getValue()+")"); entry.getValue()+")");
} }
@ -648,7 +649,7 @@ public final class IndexSchema {
boolean sourceIsPattern = isWildCard(source); boolean sourceIsPattern = isWildCard(source);
boolean destIsPattern = isWildCard(dest); boolean destIsPattern = isWildCard(dest);
log.fine("copyField source='"+source+"' dest='"+dest+"'"); log.debug("copyField source='"+source+"' dest='"+dest+"'");
SchemaField d = getField(dest); SchemaField d = getField(dest);
if(sourceIsPattern) { if(sourceIsPattern) {
@ -700,7 +701,7 @@ public final class IndexSchema {
temp[temp.length -1] = dcopy; temp[temp.length -1] = dcopy;
dynamicCopyFields = temp; dynamicCopyFields = temp;
} }
log.finest("Dynamic Copy Field:" + dcopy ); log.trace("Dynamic Copy Field:" + dcopy );
} }
private static Object[] append(Object[] orig, Object item) { private static Object[] append(Object[] orig, Object item) {

View File

@ -37,7 +37,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -74,8 +73,8 @@ public class QueryParsing {
try { try {
Query query = schema.getSolrQueryParser(defaultField).parse(qs); Query query = schema.getSolrQueryParser(defaultField).parse(qs);
if (SolrCore.log.isLoggable(Level.FINEST)) { if (SolrCore.log.isTraceEnabled() ) {
SolrCore.log.finest("After QueryParser:" + query); SolrCore.log.trace("After QueryParser:" + query);
} }
return query; return query;
@ -102,8 +101,8 @@ public class QueryParsing {
} }
Query query = parser.parse(qs); Query query = parser.parse(qs);
if (SolrCore.log.isLoggable(Level.FINEST)) { if (SolrCore.log.isTraceEnabled() ) {
SolrCore.log.finest("After QueryParser:" + query); SolrCore.log.trace("After QueryParser:" + query);
} }
return query; return query;

View File

@ -20,7 +20,8 @@ package org.apache.solr.search;
import org.apache.solr.core.SolrInfoMBean; import org.apache.solr.core.SolrInfoMBean;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
@ -30,7 +31,7 @@ import java.io.IOException;
* @version $Id$ * @version $Id$
*/ */
public interface SolrCache extends SolrInfoMBean { public interface SolrCache extends SolrInfoMBean {
public final static Logger log = Logger.getLogger(SolrCache.class.getName()); public final static Logger log = LoggerFactory.getLogger(SolrCache.class);
/** /**

View File

@ -35,8 +35,8 @@ import org.apache.solr.util.OpenBitSet;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
/** /**
@ -54,7 +54,7 @@ import java.util.logging.Logger;
// NOTE: as of Lucene 1.9, this has changed! // NOTE: as of Lucene 1.9, this has changed!
public class SolrIndexSearcher extends Searcher implements SolrInfoMBean { public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
private static Logger log = Logger.getLogger(SolrIndexSearcher.class.getName()); private static Logger log = LoggerFactory.getLogger(SolrIndexSearcher.class);
private final SolrCore core; private final SolrCore core;
private final IndexSchema schema; private final IndexSchema schema;
@ -195,7 +195,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
} }
log.info(sb.toString()); log.info(sb.toString());
} else { } else {
log.fine("Closing " + name); log.debug("Closing " + name);
} }
core.getInfoRegistry().remove(name); core.getInfoRegistry().remove(name);
try { try {
@ -888,7 +888,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
searcher.search(query, hc ); searcher.search(query, hc );
} }
catch( TimeLimitedCollector.TimeExceededException x ) { catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() ); log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true); qr.setPartialResults(true);
} }
@ -920,7 +920,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
searcher.search(query, hc ); searcher.search(query, hc );
} }
catch( TimeLimitedCollector.TimeExceededException x ) { catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() ); log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true); qr.setPartialResults(true);
} }
@ -966,7 +966,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
searcher.search(query, hc ); searcher.search(query, hc );
} }
catch( TimeLimitedCollector.TimeExceededException x ) { catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() ); log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true); qr.setPartialResults(true);
} }
@ -1089,7 +1089,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
); );
} }
catch( TimeLimitedCollector.TimeExceededException x ) { catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() ); log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true); qr.setPartialResults(true);
} }
@ -1119,7 +1119,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
); );
} }
catch( TimeLimitedCollector.TimeExceededException x ) { catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() ); log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true); qr.setPartialResults(true);
} }
@ -1161,7 +1161,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
); );
} }
catch( TimeLimitedCollector.TimeExceededException x ) { catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() ); log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true); qr.setPartialResults(true);
} }
@ -1510,7 +1510,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
*/ */
public void warm(SolrIndexSearcher old) throws IOException { public void warm(SolrIndexSearcher old) throws IOException {
// Make sure this is first! filters can help queryResults execute! // Make sure this is first! filters can help queryResults execute!
boolean logme = log.isLoggable(Level.INFO); boolean logme = log.isInfoEnabled();
long warmingStartTime = System.currentTimeMillis(); long warmingStartTime = System.currentTimeMillis();
// warm the caches in order... // warm the caches in order...
for (int i=0; i<cacheList.length; i++) { for (int i=0; i<cacheList.length; i++) {

View File

@ -188,7 +188,7 @@ public class FileFloatSource extends ValueSource {
is = VersionedFile.getLatestFile(ffs.dataDir, fname); is = VersionedFile.getLatestFile(ffs.dataDir, fname);
} catch (IOException e) { } catch (IOException e) {
// log, use defaults // log, use defaults
SolrCore.log.severe("Error opening external value source file: " +e); SolrCore.log.error("Error opening external value source file: " +e);
return vals; return vals;
} }
@ -251,7 +251,7 @@ public class FileFloatSource extends ValueSource {
fval=Float.parseFloat(val); fval=Float.parseFloat(val);
} catch (Exception e) { } catch (Exception e) {
if (++otherErrors<=10) { if (++otherErrors<=10) {
SolrCore.log.severe( "Error loading external value source + fileName + " + e SolrCore.log.error( "Error loading external value source + fileName + " + e
+ (otherErrors<10 ? "" : "\tSkipping future errors for this file.") + (otherErrors<10 ? "" : "\tSkipping future errors for this file.")
); );
} }
@ -325,7 +325,7 @@ public class FileFloatSource extends ValueSource {
} }
} catch (IOException e) { } catch (IOException e) {
// log, use defaults // log, use defaults
SolrCore.log.severe("Error loading external value source: " +e); SolrCore.log.error("Error loading external value source: " +e);
} finally { } finally {
// swallow exceptions on close so we don't override any // swallow exceptions on close so we don't override any
// exceptions that happened in the loop // exceptions that happened in the loop

View File

@ -23,7 +23,8 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.lucene.analysis.Token; import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.analysis.WhitespaceAnalyzer;
@ -52,7 +53,7 @@ import org.apache.solr.schema.FieldType;
* @since solr 1.3 * @since solr 1.3
*/ */
public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker { public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker {
public static final Logger LOG = Logger.getLogger(AbstractLuceneSpellChecker.class.getName()); public static final Logger log = LoggerFactory.getLogger(AbstractLuceneSpellChecker.class);
public static final String SPELLCHECKER_ARG_NAME = "spellchecker"; public static final String SPELLCHECKER_ARG_NAME = "spellchecker";
public static final String LOCATION = "sourceLocation"; public static final String LOCATION = "sourceLocation";
@ -120,7 +121,7 @@ public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker {
analyzer = fieldType.getQueryAnalyzer(); analyzer = fieldType.getQueryAnalyzer();
} }
if (analyzer == null) { if (analyzer == null) {
LOG.info("Using WhitespaceAnalzyer for dictionary: " + name); log.info("Using WhitespaceAnalzyer for dictionary: " + name);
analyzer = new WhitespaceAnalyzer(); analyzer = new WhitespaceAnalyzer();
} }
return name; return name;

View File

@ -19,8 +19,8 @@ package org.apache.solr.spelling;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.List; import java.util.List;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
@ -47,7 +47,7 @@ import org.apache.solr.search.SolrIndexSearcher;
**/ **/
public class FileBasedSpellChecker extends AbstractLuceneSpellChecker { public class FileBasedSpellChecker extends AbstractLuceneSpellChecker {
private static final Logger log = Logger.getLogger(FileBasedSpellChecker.class.getName()); private static final Logger log = LoggerFactory.getLogger(FileBasedSpellChecker.class);
public static final String SOURCE_FILE_CHAR_ENCODING = "characterEncoding"; public static final String SOURCE_FILE_CHAR_ENCODING = "characterEncoding";
@ -118,7 +118,7 @@ public class FileBasedSpellChecker extends AbstractLuceneSpellChecker {
} catch (IOException e) { } catch (IOException e) {
log.log(Level.SEVERE, "Unable to load spellings", e); log.error( "Unable to load spellings", e);
} finally { } finally {
try { try {
if (searcher != null) if (searcher != null)

View File

@ -28,7 +28,8 @@ import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.util.HighFrequencyDictionary; import org.apache.solr.util.HighFrequencyDictionary;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
@ -44,7 +45,7 @@ import java.util.logging.Logger;
* @since solr 1.3 * @since solr 1.3
**/ **/
public class IndexBasedSpellChecker extends AbstractLuceneSpellChecker { public class IndexBasedSpellChecker extends AbstractLuceneSpellChecker {
private static final Logger log = Logger.getLogger(IndexBasedSpellChecker.class.getName()); private static final Logger log = LoggerFactory.getLogger(IndexBasedSpellChecker.class);
public static final String THRESHOLD_TOKEN_FREQUENCY = "thresholdTokenFrequency"; public static final String THRESHOLD_TOKEN_FREQUENCY = "thresholdTokenFrequency";

View File

@ -21,7 +21,6 @@ import org.apache.lucene.search.*;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@ -45,7 +44,7 @@ public class OldRequestHandler implements SolrRequestHandler {
long numErrors; long numErrors;
public void init(NamedList args) { public void init(NamedList args) {
SolrCore.log.log(Level.INFO, "Unused request handler arguments:" + args); SolrCore.log.info( "Unused request handler arguments:" + args);
} }

View File

@ -24,8 +24,8 @@ import org.apache.lucene.index.IndexReader;
import java.util.*; import java.util.*;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.logging.Logger; import org.slf4j.Logger;
import java.util.logging.Level; import org.slf4j.LoggerFactory;
import java.net.URL; import java.net.URL;
import org.apache.solr.util.OpenBitSet; import org.apache.solr.util.OpenBitSet;
@ -45,10 +45,10 @@ import org.apache.solr.request.SolrQueryResponse;
*/ */
@Deprecated @Deprecated
public class TestRequestHandler implements SolrRequestHandler { public class TestRequestHandler implements SolrRequestHandler {
private static Logger log = Logger.getLogger(SolrIndexSearcher.class.getName()); private static Logger log = LoggerFactory.getLogger(SolrIndexSearcher.class);
public void init(NamedList args) { public void init(NamedList args) {
SolrCore.log.log(Level.INFO, "Unused request handler arguments:" + args); SolrCore.log.info( "Unused request handler arguments:" + args);
} }
// use test instead of assert since asserts may be turned off // use test instead of assert since asserts may be turned off

View File

@ -30,7 +30,6 @@ import org.apache.lucene.search.Query;
import java.util.HashSet; import java.util.HashSet;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@ -136,8 +135,8 @@ public class DirectUpdateHandler extends UpdateHandler {
try { try {
Term term = new Term(idField.getName(), indexedId); Term term = new Term(idField.getName(), indexedId);
num = ir.deleteDocuments(term); num = ir.deleteDocuments(term);
if (core.log.isLoggable(Level.FINEST)) { if (core.log.isTraceEnabled()) {
core.log.finest( core.getLogId()+"deleted " + num + " docs matching id " + idFieldType.indexedToReadable(indexedId)); core.log.trace( core.getLogId()+"deleted " + num + " docs matching id " + idFieldType.indexedToReadable(indexedId));
} }
} finally { } finally {
try { if (tdocs != null) tdocs.close(); } catch (Exception e) {} try { if (tdocs != null) tdocs.close(); } catch (Exception e) {}
@ -204,8 +203,8 @@ public class DirectUpdateHandler extends UpdateHandler {
totDeleted = deleter.deleted; totDeleted = deleter.deleted;
} }
if (core.log.isLoggable(Level.FINE)) { if (core.log.isDebugEnabled()) {
core.log.fine(core.getLogId()+"docs deleted:" + totDeleted); core.log.debug(core.getLogId()+"docs deleted:" + totDeleted);
} }
} }

View File

@ -34,7 +34,6 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@ -516,7 +515,7 @@ public class DirectUpdateHandler2 extends UpdateHandler {
autoCommitCount++; autoCommitCount++;
} }
catch (Exception e) { catch (Exception e) {
log.severe( "auto commit error..." ); log.error( "auto commit error..." );
e.printStackTrace(); e.printStackTrace();
} }
finally { finally {

View File

@ -25,7 +25,8 @@ import org.apache.lucene.store.*;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.IndexSchema;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
/** /**
@ -37,13 +38,13 @@ import java.io.IOException;
public class SolrIndexWriter extends IndexWriter { public class SolrIndexWriter extends IndexWriter {
private static Logger log = Logger.getLogger(SolrIndexWriter.class.getName()); private static Logger log = LoggerFactory.getLogger(SolrIndexWriter.class);
String name; String name;
IndexSchema schema; IndexSchema schema;
private void init(String name, IndexSchema schema, SolrIndexConfig config) throws IOException { private void init(String name, IndexSchema schema, SolrIndexConfig config) throws IOException {
log.fine("Opened Writer " + name); log.debug("Opened Writer " + name);
this.name = name; this.name = name;
this.schema = schema; this.schema = schema;
setSimilarity(schema.getSimilarity()); setSimilarity(schema.getSimilarity());
@ -83,7 +84,7 @@ public class SolrIndexWriter extends IndexWriter {
String rawLockType = (null == config) ? null : config.lockType; String rawLockType = (null == config) ? null : config.lockType;
if (null == rawLockType) { if (null == rawLockType) {
// we default to "simple" for backwards compatiblitiy // we default to "simple" for backwards compatiblitiy
log.warning("No lockType configured for " + path + " assuming 'simple'"); log.warn("No lockType configured for " + path + " assuming 'simple'");
rawLockType = "simple"; rawLockType = "simple";
} }
final String lockType = rawLockType.toLowerCase().trim(); final String lockType = rawLockType.toLowerCase().trim();
@ -98,7 +99,7 @@ public class SolrIndexWriter extends IndexWriter {
d.setLockFactory(new SingleInstanceLockFactory()); d.setLockFactory(new SingleInstanceLockFactory());
} else if ("none".equals(lockType)) { } else if ("none".equals(lockType)) {
// recipie for disaster // recipie for disaster
log.severe("CONFIGURATION WARNING: locks are disabled on " + path); log.error("CONFIGURATION WARNING: locks are disabled on " + path);
d.setLockFactory(new NoLockFactory()); d.setLockFactory(new NoLockFactory());
} else { } else {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
@ -149,7 +150,7 @@ public class SolrIndexWriter extends IndexWriter {
*/ */
public void close() throws IOException { public void close() throws IOException {
log.fine("Closing Writer " + name); log.debug("Closing Writer " + name);
super.close(); super.close();
} }

View File

@ -26,7 +26,8 @@ import org.apache.lucene.search.HitCollector;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Vector; import java.util.Vector;
import java.io.IOException; import java.io.IOException;
@ -50,7 +51,7 @@ import javax.xml.xpath.XPathConstants;
*/ */
public abstract class UpdateHandler implements SolrInfoMBean { public abstract class UpdateHandler implements SolrInfoMBean {
protected final static Logger log = Logger.getLogger(UpdateHandler.class.getName()); protected final static Logger log = LoggerFactory.getLogger(UpdateHandler.class);
protected final SolrCore core; protected final SolrCore core;
protected final IndexSchema schema; protected final IndexSchema schema;

View File

@ -20,7 +20,6 @@ package org.apache.solr.update.processor;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
@ -53,8 +52,8 @@ public class LogUpdateProcessorFactory extends UpdateRequestProcessorFactory {
@Override @Override
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) { public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) {
boolean doLog = LogUpdateProcessor.log.isLoggable(Level.INFO); boolean doLog = LogUpdateProcessor.log.isInfoEnabled();
// LogUpdateProcessor.log.severe("Will Log=" + doLog); // LogUpdateProcessor.log.error("Will Log=" + doLog);
if( doLog ) { if( doLog ) {
// only create the log processor if we will use it // only create the log processor if we will use it
return new LogUpdateProcessor(req, rsp, this, next); return new LogUpdateProcessor(req, rsp, this, next);

View File

@ -18,7 +18,8 @@
package org.apache.solr.update.processor; package org.apache.solr.update.processor;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.solr.update.AddUpdateCommand; import org.apache.solr.update.AddUpdateCommand;
import org.apache.solr.update.CommitUpdateCommand; import org.apache.solr.update.CommitUpdateCommand;
@ -38,7 +39,7 @@ import org.apache.solr.update.DeleteUpdateCommand;
* @since solr 1.3 * @since solr 1.3
*/ */
public abstract class UpdateRequestProcessor { public abstract class UpdateRequestProcessor {
protected static Logger log = Logger.getLogger(UpdateRequestProcessor.class.getName()); protected static Logger log = LoggerFactory.getLogger(UpdateRequestProcessor.class);
protected final UpdateRequestProcessor next; protected final UpdateRequestProcessor next;

View File

@ -19,7 +19,8 @@ package org.apache.solr.util;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* A collection on common params, both for Plugin initialization and * A collection on common params, both for Plugin initialization and
@ -29,7 +30,7 @@ import java.util.logging.Logger;
@Deprecated @Deprecated
public class CommonParams implements org.apache.solr.common.params.CommonParams { public class CommonParams implements org.apache.solr.common.params.CommonParams {
public static Logger log = Logger.getLogger(CommonParams.class.getName()); public static Logger log = LoggerFactory.getLogger(CommonParams.class);
/** the default field list to be used */ /** the default field list to be used */
@ -84,7 +85,7 @@ public class CommonParams implements org.apache.solr.common.params.CommonParams
if (tmp instanceof String) { if (tmp instanceof String) {
fl = tmp.toString(); fl = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + FL); log.error("init param is not a str: " + FL);
} }
} }
@ -93,7 +94,7 @@ public class CommonParams implements org.apache.solr.common.params.CommonParams
if (tmp instanceof String) { if (tmp instanceof String) {
df = tmp.toString(); df = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + DF); log.error("init param is not a str: " + DF);
} }
} }
@ -102,7 +103,7 @@ public class CommonParams implements org.apache.solr.common.params.CommonParams
if (tmp instanceof String) { if (tmp instanceof String) {
debugQuery = tmp.toString(); debugQuery = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + DEBUG_QUERY); log.error("init param is not a str: " + DEBUG_QUERY);
} }
} }
@ -111,7 +112,7 @@ public class CommonParams implements org.apache.solr.common.params.CommonParams
if (tmp instanceof String) { if (tmp instanceof String) {
explainOther = tmp.toString(); explainOther = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + EXPLAIN_OTHER); log.error("init param is not a str: " + EXPLAIN_OTHER);
} }
} }

View File

@ -17,7 +17,8 @@
package org.apache.solr.util; package org.apache.solr.util;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
@ -28,7 +29,7 @@ import org.apache.solr.common.util.NamedList;
@Deprecated @Deprecated
public class DisMaxParams extends CommonParams implements org.apache.solr.common.params.DisMaxParams { public class DisMaxParams extends CommonParams implements org.apache.solr.common.params.DisMaxParams {
public static Logger log = Logger.getLogger(DisMaxParams.class.getName()); public static Logger log = LoggerFactory.getLogger(DisMaxParams.class);
/** query and init param for filtering query /** query and init param for filtering query
@ -104,7 +105,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof Float) { if (tmp instanceof Float) {
tiebreaker = ((Float)tmp).floatValue(); tiebreaker = ((Float)tmp).floatValue();
} else { } else {
log.severe("init param is not a float: " + TIE); log.error("init param is not a float: " + TIE);
} }
} }
@ -113,7 +114,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof String) { if (tmp instanceof String) {
qf = tmp.toString(); qf = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + QF); log.error("init param is not a str: " + QF);
} }
} }
@ -122,7 +123,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof String) { if (tmp instanceof String) {
pf = tmp.toString(); pf = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + PF); log.error("init param is not a str: " + PF);
} }
} }
@ -132,7 +133,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof String) { if (tmp instanceof String) {
mm = tmp.toString(); mm = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + MM); log.error("init param is not a str: " + MM);
} }
} }
@ -141,7 +142,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof Integer) { if (tmp instanceof Integer) {
pslop = ((Integer)tmp).intValue(); pslop = ((Integer)tmp).intValue();
} else { } else {
log.severe("init param is not an int: " + PS); log.error("init param is not an int: " + PS);
} }
} }
@ -150,7 +151,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof String) { if (tmp instanceof String) {
bq = tmp.toString(); bq = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + BQ); log.error("init param is not a str: " + BQ);
} }
} }
@ -159,7 +160,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof String) { if (tmp instanceof String) {
bf = tmp.toString(); bf = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + BF); log.error("init param is not a str: " + BF);
} }
} }
@ -168,7 +169,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof String) { if (tmp instanceof String) {
fq = tmp.toString(); fq = tmp.toString();
} else { } else {
log.severe("init param is not a str: " + FQ); log.error("init param is not a str: " + FQ);
} }
} }

View File

@ -39,9 +39,7 @@ import org.apache.solr.search.*;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.Matcher;
/** /**
* <p>Utilities that may be of use to RequestHandlers.</p> * <p>Utilities that may be of use to RequestHandlers.</p>
@ -821,7 +819,7 @@ public class SolrPluginUtils {
/* we definitely had some sort of sort string from the user, /* we definitely had some sort of sort string from the user,
* but no SortSpec came out of it * but no SortSpec came out of it
*/ */
SolrCore.log.log(Level.WARNING,"Invalid sort \""+sort+"\" was specified, ignoring", sortE); SolrCore.log.warn("Invalid sort \""+sort+"\" was specified, ignoring", sortE);
return null; return null;
} }

View File

@ -19,7 +19,8 @@ package org.apache.solr.util.plugin;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.solr.common.ResourceLoader; import org.apache.solr.common.ResourceLoader;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
@ -37,7 +38,7 @@ import org.w3c.dom.NodeList;
*/ */
public abstract class AbstractPluginLoader<T> public abstract class AbstractPluginLoader<T>
{ {
public static Logger log = Logger.getLogger(AbstractPluginLoader.class.getName()); public static Logger log = LoggerFactory.getLogger(AbstractPluginLoader.class);
private final String type; private final String type;
private final boolean preRegister; private final boolean preRegister;

View File

@ -19,8 +19,8 @@ package org.apache.solr.util.xslt;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.logging.Level; import org.slf4j.Logger;
import java.util.logging.Logger; import org.slf4j.LoggerFactory;
import javax.xml.transform.Templates; import javax.xml.transform.Templates;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
@ -51,11 +51,11 @@ public class TransformerProvider {
/** singleton */ /** singleton */
private TransformerProvider() { private TransformerProvider() {
log = Logger.getLogger(TransformerProvider.class.getName()); log = LoggerFactory.getLogger(TransformerProvider.class.getName());
// tell'em: currently, we only cache the last used XSLT transform, and blindly recompile it // tell'em: currently, we only cache the last used XSLT transform, and blindly recompile it
// once cacheLifetimeSeconds expires // once cacheLifetimeSeconds expires
log.warning( log.warn(
"The TransformerProvider's simplistic XSLT caching mechanism is not appropriate " "The TransformerProvider's simplistic XSLT caching mechanism is not appropriate "
+ "for high load scenarios, unless a single XSLT transform is used" + "for high load scenarios, unless a single XSLT transform is used"
+ " and xsltCacheLifetimeSeconds is set to a sufficiently high value." + " and xsltCacheLifetimeSeconds is set to a sufficiently high value."
@ -69,8 +69,8 @@ public class TransformerProvider {
// For now, the Templates are blindly reloaded once cacheExpires is over. // For now, the Templates are blindly reloaded once cacheExpires is over.
// It'd be better to check the file modification time to reload only if needed. // It'd be better to check the file modification time to reload only if needed.
if(lastTemplates!=null && filename.equals(lastFilename) && System.currentTimeMillis() < cacheExpires) { if(lastTemplates!=null && filename.equals(lastFilename) && System.currentTimeMillis() < cacheExpires) {
if(log.isLoggable(Level.FINE)) { if(log.isDebugEnabled()) {
log.fine("Using cached Templates:" + filename); log.debug("Using cached Templates:" + filename);
} }
} else { } else {
lastTemplates = getTemplates(solrConfig.getResourceLoader(), filename,cacheLifetimeSeconds); lastTemplates = getTemplates(solrConfig.getResourceLoader(), filename,cacheLifetimeSeconds);
@ -81,7 +81,7 @@ public class TransformerProvider {
try { try {
result = lastTemplates.newTransformer(); result = lastTemplates.newTransformer();
} catch(TransformerConfigurationException tce) { } catch(TransformerConfigurationException tce) {
log.throwing(getClass().getName(), "getTransformer", tce); log.error(getClass().getName(), "getTransformer", tce);
final IOException ioe = new IOException("newTransformer fails ( " + lastFilename + ")"); final IOException ioe = new IOException("newTransformer fails ( " + lastFilename + ")");
ioe.initCause(tce); ioe.initCause(tce);
throw ioe; throw ioe;
@ -96,13 +96,13 @@ public class TransformerProvider {
Templates result = null; Templates result = null;
lastFilename = null; lastFilename = null;
try { try {
if(log.isLoggable(Level.FINE)) { if(log.isDebugEnabled()) {
log.fine("compiling XSLT templates:" + filename); log.debug("compiling XSLT templates:" + filename);
} }
final InputStream xsltStream = loader.openResource("xslt/" + filename); final InputStream xsltStream = loader.openResource("xslt/" + filename);
result = tFactory.newTemplates(new StreamSource(xsltStream)); result = tFactory.newTemplates(new StreamSource(xsltStream));
} catch (Exception e) { } catch (Exception e) {
log.throwing(getClass().getName(), "newTemplates", e); log.error(getClass().getName(), "newTemplates", e);
final IOException ioe = new IOException("Unable to initialize Templates '" + filename + "'"); final IOException ioe = new IOException("Unable to initialize Templates '" + filename + "'");
ioe.initCause(e); ioe.initCause(e);
throw ioe; throw ioe;

View File

@ -21,8 +21,8 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.logging.Logger; import org.slf4j.Logger;
import java.util.logging.Level; import org.slf4j.LoggerFactory;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
@ -47,7 +47,7 @@ import org.apache.solr.servlet.cache.Method;
*/ */
public class SolrDispatchFilter implements Filter public class SolrDispatchFilter implements Filter
{ {
final Logger log = Logger.getLogger(SolrDispatchFilter.class.getName()); final Logger log = LoggerFactory.getLogger(SolrDispatchFilter.class);
protected CoreContainer cores; protected CoreContainer cores;
protected String pathPrefix = null; // strip this from the beginning of a path protected String pathPrefix = null; // strip this from the beginning of a path
@ -72,7 +72,7 @@ public class SolrDispatchFilter implements Filter
} }
catch( Throwable t ) { catch( Throwable t ) {
// catch this so our filter still works // catch this so our filter still works
log.log(Level.SEVERE, "Could not start SOLR. Check solr/home property", t); log.error( "Could not start SOLR. Check solr/home property", t);
SolrConfig.severeErrors.add( t ); SolrConfig.severeErrors.add( t );
SolrCore.log( t ); SolrCore.log( t );
} }
@ -275,7 +275,7 @@ public class SolrDispatchFilter implements Filter
} }
} }
} }
log.fine("no handler or core retrieved for " + path + ", follow through..."); log.debug("no handler or core retrieved for " + path + ", follow through...");
} }
catch (Throwable ex) { catch (Throwable ex) {
sendError( (HttpServletResponse)response, ex ); sendError( (HttpServletResponse)response, ex );
@ -320,7 +320,7 @@ public class SolrDispatchFilter implements Filter
// non standard codes have undefined results with various servers // non standard codes have undefined results with various servers
if( code < 100 ) { if( code < 100 ) {
log.warning( "invalid return code: "+code ); log.warn( "invalid return code: "+code );
code = 500; code = 500;
} }
} }

View File

@ -29,7 +29,8 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -51,7 +52,7 @@ import org.apache.solr.request.SolrQueryRequestBase;
public class SolrRequestParsers public class SolrRequestParsers
{ {
final Logger log = Logger.getLogger(SolrRequestParsers.class.getName()); final Logger log = LoggerFactory.getLogger(SolrRequestParsers.class);
// Should these constants be in a more public place? // Should these constants be in a more public place?
public static final String MULTIPART = "multipart"; public static final String MULTIPART = "multipart";

View File

@ -20,7 +20,8 @@ package org.apache.solr.servlet;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
@ -44,7 +45,7 @@ import org.apache.solr.request.SolrRequestHandler;
@Deprecated @Deprecated
public class SolrServlet extends HttpServlet { public class SolrServlet extends HttpServlet {
final Logger log = Logger.getLogger(SolrServlet.class.getName()); final Logger log = LoggerFactory.getLogger(SolrServlet.class);
private boolean hasMulticore = false; private boolean hasMulticore = false;
public void init() throws ServletException { public void init() throws ServletException {
@ -78,7 +79,7 @@ public class SolrServlet extends HttpServlet {
SolrRequestHandler handler = core.getRequestHandler(solrReq.getQueryType()); SolrRequestHandler handler = core.getRequestHandler(solrReq.getQueryType());
if (handler==null) { if (handler==null) {
log.warning("Unknown Request Handler '" + solrReq.getQueryType() +"' :" + solrReq); log.warn("Unknown Request Handler '" + solrReq.getQueryType() +"' :" + solrReq);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + solrReq.getQueryType() + "'", true); throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + solrReq.getQueryType() + "'", true);
} }
core.execute(handler, solrReq, solrRsp ); core.execute(handler, solrReq, solrRsp );

View File

@ -19,7 +19,8 @@ import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.logging.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
@ -38,7 +39,7 @@ import org.apache.solr.request.XMLResponseWriter;
*/ */
@Deprecated @Deprecated
public class SolrUpdateServlet extends HttpServlet { public class SolrUpdateServlet extends HttpServlet {
final Logger log = Logger.getLogger(SolrUpdateServlet.class.getName()); final Logger log = LoggerFactory.getLogger(SolrUpdateServlet.class);
XmlUpdateRequestHandler legacyUpdateHandler; XmlUpdateRequestHandler legacyUpdateHandler;
XMLResponseWriter xmlResponseWriter; XMLResponseWriter xmlResponseWriter;
@ -69,7 +70,7 @@ public class SolrUpdateServlet extends HttpServlet {
response.setContentType(QueryResponseWriter.CONTENT_TYPE_XML_UTF8); response.setContentType(QueryResponseWriter.CONTENT_TYPE_XML_UTF8);
if( request.getQueryString() != null ) { if( request.getQueryString() != null ) {
log.warning( log.warn(
"The @Deprecated SolrUpdateServlet does not accept query parameters: "+request.getQueryString()+"\n" "The @Deprecated SolrUpdateServlet does not accept query parameters: "+request.getQueryString()+"\n"
+" If you are using solrj, make sure to register a request handler to /update rather then use this servlet.\n" +" If you are using solrj, make sure to register a request handler to /update rather then use this servlet.\n"
+" Add: <requestHandler name=\"/update\" class=\"solr.XmlUpdateRequestHandler\" > to your solrconfig.xml\n\n" ); +" Add: <requestHandler name=\"/update\" class=\"solr.XmlUpdateRequestHandler\" > to your solrconfig.xml\n\n" );