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
----------------------
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
----------------------

View File

@ -87,4 +87,29 @@ Some portions of the code are Copyright:
1999 Jason Gilbert.
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.Date;
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.XMLStreamConstants;
@ -44,7 +45,7 @@ import org.apache.solr.common.util.SimpleOrderedMap;
*/
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
// won't be duplicated
@ -63,7 +64,7 @@ public class XMLResponseParser extends ResponseParser
catch( IllegalArgumentException ex ) {
// Other implementations will likely throw this exception since "reuse-instance"
// 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 java.io.File;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @version $Id$
* @since solr 1.3
*/
public class TestSolrProperties {
protected static Logger log = Logger.getLogger(TestSolrProperties.class.getName());
protected static Logger log = LoggerFactory.getLogger(TestSolrProperties.class);
protected CoreContainer cores = null;
public String getSolrHome() {
@ -73,7 +74,7 @@ public class TestSolrProperties {
log.info("NOTE: per solr.test.leavedatadir, dataDir will not be removed: " + dataDir.getAbsolutePath());
} else {
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");

View File

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

View File

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

View File

@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
@ -43,8 +43,8 @@ import java.util.logging.Logger;
* @since solr 1.3
*/
public class DateFormatTransformer extends Transformer {
private static final Logger LOG = Logger
.getLogger(DateFormatTransformer.class.getName());
private static final Logger LOG = LoggerFactory
.getLogger(DateFormatTransformer.class);
@SuppressWarnings("unchecked")
public Object transformRow(Map<String, Object> aRow, Context context) {
@ -70,7 +70,7 @@ public class DateFormatTransformer extends Transformer {
aRow.put(column, process(value, fmt));
}
} 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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,8 @@
package org.apache.solr.analysis;
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$
*/
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 */
protected Map<String,String> args;

View File

@ -17,7 +17,8 @@
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.PrintWriter;
@ -129,14 +130,14 @@ public class SolrException extends RuntimeException {
public void log(Logger log) { log(log,this); }
public static void log(Logger log, Throwable e) {
log.severe(toStr(e));
log.error(toStr(e));
if (e instanceof SolrException) {
((SolrException)e).logged = true;
}
}
public static void log(Logger log, String msg, Throwable e) {
log.severe(msg + ':' + toStr(e));
log.error(msg + ':' + toStr(e));
if (e instanceof SolrException) {
((SolrException)e).logged = true;
}

View File

@ -62,7 +62,7 @@ public class StrUtils {
/***
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 java.io.*;
import java.util.List;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @version $Id$
*/
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();
@ -170,12 +171,12 @@ public class Config {
if (errIfMissing) {
throw new RuntimeException(name + " missing "+path);
} else {
log.fine(name + " missing optional " + path);
log.debug(name + " missing optional " + path);
return null;
}
}
log.finest(name + ":" + path + "=" + nd);
log.trace(name + ":" + path + "=" + nd);
return nd;
} catch (XPathExpressionException e) {
@ -195,7 +196,7 @@ public class Config {
String txt = DOMUtil.getText(nd);
log.fine(name + ' '+path+'='+txt);
log.debug(name + ' '+path+'='+txt);
return txt;
/******

View File

@ -26,7 +26,8 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.channels.FileChannel;
import java.util.*;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathConstants;
@ -50,7 +51,7 @@ import org.xml.sax.SAXException;
*/
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 boolean persistent = false;

View File

@ -27,8 +27,8 @@ import javax.management.remote.JMXServiceURL;
import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
@ -46,7 +46,7 @@ import java.util.logging.Logger;
*/
public class JmxMonitoredMap<K, V> extends
ConcurrentHashMap<String, SolrInfoMBean> {
private static final Logger LOG = Logger.getLogger(JmxMonitoredMap.class
private static final Logger LOG = LoggerFactory.getLogger(JmxMonitoredMap.class
.getName());
private MBeanServer server = null;
@ -136,7 +136,7 @@ public class JmxMonitoredMap<K, V> extends
SolrDynamicMBean mbean = new SolrDynamicMBean(infoBean);
server.registerMBean(mbean, name);
} 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 {
unregister((String) key, infoBean);
} 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);
@ -231,7 +231,7 @@ public class JmxMonitoredMap<K, V> extends
}
}
} catch (Exception e) {
LOG.log(Level.WARNING, "Could not getStatistics on info bean "
LOG.warn( "Could not getStatistics on info bean "
+ infoBean.getName(), e);
}
@ -272,7 +272,7 @@ public class JmxMonitoredMap<K, V> extends
try {
list.add(new Attribute(attribute, getAttribute(attribute)));
} 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.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.xpath.XPathConstants;
@ -43,7 +44,7 @@ import org.w3c.dom.Node;
/**
*/
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";
protected final SolrCore core;

View File

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

View File

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

View File

@ -63,7 +63,8 @@ import java.io.IOException;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URL;
@ -73,7 +74,7 @@ import java.net.URL;
public final class SolrCore implements SolrInfoMBean {
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 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;
BooleanQuery.setMaxClauseCount(boolean_query_max_clause_count);
} 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...
Directory dir = SolrIndexWriter.getDirectory(getIndexDir(), solrConfig.mainIndexConfig);
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);
}
}
// Create the index if it doesn't exist.
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...");
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) {
//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;
}
log.info(logid+" CLOSING SolrCore " + this);
@ -653,7 +654,7 @@ public final class SolrCore implements SolrInfoMBean {
protected void finalize() {
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++;
if (onDeckSearchers < 1) {
// should never happen... just a sanity check
log.severe(logid+"ERROR!!! onDeckSearchers is " + onDeckSearchers);
log.error(logid+"ERROR!!! onDeckSearchers is " + onDeckSearchers);
onDeckSearchers=1; // reset
} else if (onDeckSearchers > maxWarmingSearchers) {
onDeckSearchers--;
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
throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,msg,true);
} else if (onDeckSearchers > 1) {
@ -1121,7 +1122,7 @@ public final class SolrCore implements SolrInfoMBean {
}
if (onDeckSearchers < 0) {
// 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
}
// 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();
} 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) {
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);
}
// setup response header and handle request
@ -1240,7 +1241,7 @@ public final class SolrCore implements SolrInfoMBean {
public void execute(SolrQueryRequest req, SolrQueryResponse rsp) {
SolrRequestHandler handler = getRequestHandler(req.getQueryType());
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);
}
execute(handler, req, rsp);
@ -1414,7 +1415,7 @@ public final class SolrCore implements SolrInfoMBean {
// TODO -- this should be removed in deprecation release...
String gettable = solrConfig.get("admin/gettableFiles", null );
if( gettable != null ) {
log.warning(
log.warn(
"solrconfig.xml uses deprecated <admin/gettableFiles>, Please "+
"update your config to use the ShowFileRequestHandler." );
if( getRequestHandler( "/admin/file" ) == null ) {
@ -1442,7 +1443,7 @@ public final class SolrCore implements SolrInfoMBean {
handler.init( args );
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.search.SolrIndexSearcher;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @version $Id$
*/
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);

View File

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

View File

@ -43,7 +43,8 @@ import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
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 static Logger log = Logger.getLogger(AnalysisRequestHandler.class.getName());
public static Logger log = LoggerFactory.getLogger(AnalysisRequestHandler.class);
private XMLInputFactory inputFactory;
@ -72,7 +73,7 @@ public class AnalysisRequestHandler extends RequestHandlerBase {
catch (IllegalArgumentException ex) {
// Other implementations will likely throw this exception since "reuse-instance"
// 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: {
String currTag = parser.getLocalName();
if ("doc".equals(currTag)) {
log.finest("Tokenizing doc...");
log.trace("Tokenizing doc...");
SolrInputDocument doc = readDoc(parser);
SchemaField uniq = schema.getUniqueKeyField();
@ -181,7 +182,7 @@ public class AnalysisRequestHandler extends RequestHandlerBase {
text.setLength(0);
String localName = parser.getLocalName();
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,
"unexpected XML tag doc/" + localName);
}

View File

@ -39,7 +39,8 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
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
@ -196,7 +197,7 @@ pre.code
@Deprecated
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;

View File

@ -22,7 +22,8 @@ import java.io.Reader;
import java.io.Writer;
import java.io.File;
import java.util.HashMap;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javanet.staxutils.BaseXMLInputFactory;
@ -58,7 +59,7 @@ import org.apache.solr.update.processor.UpdateRequestProcessor;
*/
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";
@ -96,7 +97,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
catch( IllegalArgumentException ex ) {
// Other implementations will likely throw this exception since "reuse-instance"
// 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:
String currTag = parser.getLocalName();
if (currTag.equals(ADD)) {
log.finest("SolrCore.update(add)");
log.trace("SolrCore.update(add)");
addCmd = new AddUpdateCommand();
boolean overwrite=true; // the default
@ -173,7 +174,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if ( OVERWRITE_COMMITTED.equals(attrName) ) {
overwriteCommitted = StrUtils.parseBoolean(attrVal);
} 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;
}
else if ("doc".equals(currTag)) {
log.finest("adding doc...");
log.trace("adding doc...");
addCmd.clear();
addCmd.solrDoc = readDoc( parser );
processor.processAdd(addCmd);
}
else if ( COMMIT.equals(currTag) || OPTIMIZE.equals(currTag)) {
log.finest("parsing " + currTag);
log.trace("parsing " + currTag);
CommitUpdateCommand cmd = new CommitUpdateCommand(OPTIMIZE.equals(currTag));
@ -214,7 +215,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
cmd.maxOptimizeSegments = Integer.parseInt(attrVal);
}
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 );
} // end commit
else if (DELETE.equals(currTag)) {
log.finest("parsing delete");
log.trace("parsing delete");
processDelete( processor, parser);
} // end delete
break;
@ -251,7 +252,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if ("fromCommitted".equals(attrName)) {
deleteCmd.fromCommitted = StrUtils.parseBoolean(attrVal);
} 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:
String mode = parser.getLocalName();
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,
"unexpected XML tag /delete/" + mode);
}
@ -278,7 +279,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if( "delete".equals( currTag ) ) {
return;
} else {
log.warning("unexpected XML tag /delete/" + currTag);
log.warn("unexpected XML tag /delete/" + currTag);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"unexpected XML tag /delete/" + currTag);
}
@ -309,7 +310,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
if ("boost".equals(attrName)) {
doc.setDocumentBoost( Float.parseFloat(parser.getAttributeValue(i)) );
} 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);
String localName = parser.getLocalName();
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,
"unexpected XML tag doc/" + localName);
}
@ -359,7 +360,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
} else if ("null".equals(attrName)) {
isNull = StrUtils.parseBoolean(attrVal);
} else {
log.warning("Unknown attribute doc/field/@" + attrName);
log.warn("Unknown attribute doc/field/@" + attrName);
}
}
break;
@ -399,7 +400,7 @@ public class XmlUpdateRequestHandler extends RequestHandlerBase
SolrException.logOnce(log, "Error processing \"legacy\" update command", ex);
XML.writeXML(output, "result", SolrException.toStr(ex), "status", "1");
} 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.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
@ -82,7 +82,7 @@ import org.apache.solr.search.SolrQueryParser;
*/
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 DOC_ID = "docId";
@ -261,7 +261,7 @@ public class LukeRequestHandler extends RequestHandlerBase
}
}
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 ) {
log.warning( "error reading field: "+fieldName );
log.warn( "error reading field: "+fieldName );
}
// 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.Map;
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.XPathConstants;
@ -77,7 +78,7 @@ import org.w3c.dom.NodeList;
*/
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
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.HttpClient;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
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_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;
@ -133,7 +134,7 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception, ParseException, InstantiationException, IllegalAccessException
{
// 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();
rb.req = req;
rb.rsp = rsp;

View File

@ -27,8 +27,8 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.xpath.XPathConstants;
@ -67,7 +67,7 @@ import org.w3c.dom.NodeList;
* @since solr 1.3
*/
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;
@ -235,7 +235,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
}
String collVal = collation.toString();
if (collVal.equals(origQuery) == false) {
LOG.fine("Collation:" + collation);
LOG.debug("Collation:" + collation);
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
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());
}
@ -335,7 +335,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
+ checker.getDictionaryName());
checker.reload();
} 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 {
// newSearcher event
@ -343,7 +343,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
LOG.info("Building spell index for spell checker: " + checker.getDictionaryName());
checker.build(core, newSearcher);
} catch (Exception e) {
LOG.log(Level.SEVERE,
log.error(
"Exception in building spell check index for spellchecker: " + checker.getDictionaryName(), e);
}
}
@ -369,17 +369,17 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
@Override
public String getVersion() {
return "$Revision:$";
return "$Revision$";
}
@Override
public String getSourceId() {
return "$Id:$";
return "$Id$";
}
@Override
public String getSource() {
return "$URL:$";
return "$URL$";
}
}

View File

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

View File

@ -24,7 +24,8 @@ import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
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.TransformerException;
@ -50,7 +51,7 @@ public class XSLTResponseWriter implements QueryResponseWriter {
public static final int XSLT_CACHE_DEFAULT = 60;
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) {
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.common.SolrException;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.HashMap;
import java.io.Reader;
@ -45,7 +46,7 @@ import java.io.IOException;
* @version $Id$
*/
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) */
protected String typeName;
@ -182,7 +183,7 @@ public abstract class FieldType extends FieldProperties {
}
if (val==null) return null;
if (!field.indexed() && !field.stored()) {
log.finest("Ignoring unindexed/unstored field: " + field);
log.trace("Ignoring unindexed/unstored field: " + field);
return null;
}
@ -364,7 +365,7 @@ public abstract class FieldType extends FieldProperties {
*/
public void setAnalyzer(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) {
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.IOException;
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
@ -56,7 +57,7 @@ import java.util.logging.Logger;
public final class IndexSchema {
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 String resourceName;
private String name;
@ -386,7 +387,7 @@ public final class IndexSchema {
Node nd = (Node) xpath.evaluate("/schema/@name", document, XPathConstants.NODE);
if (nd==null) {
log.warning("schema has no name!");
log.warn("schema has no name!");
} else {
name = nd.getNodeValue();
log.info("Schema name=" + name);
@ -429,7 +430,7 @@ public final class IndexSchema {
@Override
protected FieldType register(String name, FieldType plugin) throws Exception {
log.finest("fieldtype defined: " + plugin );
log.trace("fieldtype defined: " + plugin );
return fieldTypes.put( name, plugin );
}
};
@ -453,7 +454,7 @@ public final class IndexSchema {
NamedNodeMap attrs = node.getAttributes();
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);
FieldType ft = fieldTypes.get(type);
@ -479,13 +480,13 @@ public final class IndexSchema {
SolrConfig.severeErrors.add( t );
}
log.fine("field defined: " + f);
log.debug("field defined: " + f);
if( f.getDefaultValue() != null ) {
log.fine(name+" contains default value: " + f.getDefaultValue());
log.debug(name+" contains default value: " + f.getDefaultValue());
fieldsWithDefaultValue.add( f );
}
if (f.isRequired()) {
log.fine(name+" is required in this schema");
log.debug(name+" is required in this schema");
requiredFields.add(f);
}
} else if (node.getNodeName().equals("dynamicField")) {
@ -505,7 +506,7 @@ public final class IndexSchema {
}
if( !dup ) {
dFields.add(new DynamicField(f));
log.fine("dynamic field defined: " + f);
log.debug("dynamic field defined: " + f);
}
} else {
// we should never get here
@ -523,7 +524,7 @@ public final class IndexSchema {
// the largest string possible.
Collections.sort(dFields);
log.finest("Dynamic Field Ordering:" + dFields);
log.trace("Dynamic Field Ordering:" + dFields);
// stuff it in a normal array for faster access
dynamicFields = (DynamicField[])dFields.toArray(new DynamicField[dFields.size()]);
@ -536,7 +537,7 @@ public final class IndexSchema {
return Similarity.getDefault();
}
};
log.fine("using default similarity");
log.debug("using default similarity");
} else {
final Object obj = solrConfig.getResourceLoader().newInstance(((Element) node).getAttribute("class"));
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);
if (node==null) {
log.warning("no default search field specified in schema.");
log.warn("no default search field specified in schema.");
} else {
defaultSearchFieldName=node.getNodeValue().trim();
// 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);
if (node==null) {
log.fine("using default query parser operator (OR)");
log.debug("using default query parser operator (OR)");
} else {
queryParserDefaultOperator=node.getNodeValue().trim();
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);
if (node==null) {
log.warning("no uniqueKey specified in schema.");
log.warn("no uniqueKey specified in schema.");
} else {
uniqueKeyField=getIndexedField(node.getNodeValue().trim());
uniqueKeyFieldName=uniqueKeyField.getName();
@ -615,7 +616,7 @@ public final class IndexSchema {
for (Map.Entry<SchemaField, Integer> entry : copyFieldTargetCounts.entrySet()) {
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 ("+
entry.getValue()+")");
}
@ -648,7 +649,7 @@ public final class IndexSchema {
boolean sourceIsPattern = isWildCard(source);
boolean destIsPattern = isWildCard(dest);
log.fine("copyField source='"+source+"' dest='"+dest+"'");
log.debug("copyField source='"+source+"' dest='"+dest+"'");
SchemaField d = getField(dest);
if(sourceIsPattern) {
@ -700,7 +701,7 @@ public final class IndexSchema {
temp[temp.length -1] = dcopy;
dynamicCopyFields = temp;
}
log.finest("Dynamic Copy Field:" + dcopy );
log.trace("Dynamic Copy Field:" + dcopy );
}
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.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.regex.Pattern;
/**
@ -74,8 +73,8 @@ public class QueryParsing {
try {
Query query = schema.getSolrQueryParser(defaultField).parse(qs);
if (SolrCore.log.isLoggable(Level.FINEST)) {
SolrCore.log.finest("After QueryParser:" + query);
if (SolrCore.log.isTraceEnabled() ) {
SolrCore.log.trace("After QueryParser:" + query);
}
return query;
@ -102,8 +101,8 @@ public class QueryParsing {
}
Query query = parser.parse(qs);
if (SolrCore.log.isLoggable(Level.FINEST)) {
SolrCore.log.finest("After QueryParser:" + query);
if (SolrCore.log.isTraceEnabled() ) {
SolrCore.log.trace("After QueryParser:" + query);
}
return query;

View File

@ -20,7 +20,8 @@ package org.apache.solr.search;
import org.apache.solr.core.SolrInfoMBean;
import java.util.Map;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -30,7 +31,7 @@ import java.io.IOException;
* @version $Id$
*/
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.net.URL;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@ -54,7 +54,7 @@ import java.util.logging.Logger;
// NOTE: as of Lucene 1.9, this has changed!
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 IndexSchema schema;
@ -195,7 +195,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
}
log.info(sb.toString());
} else {
log.fine("Closing " + name);
log.debug("Closing " + name);
}
core.getInfoRegistry().remove(name);
try {
@ -888,7 +888,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
searcher.search(query, hc );
}
catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() );
log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true);
}
@ -920,7 +920,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
searcher.search(query, hc );
}
catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() );
log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true);
}
@ -966,7 +966,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
searcher.search(query, hc );
}
catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() );
log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true);
}
@ -1089,7 +1089,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
);
}
catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() );
log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true);
}
@ -1119,7 +1119,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
);
}
catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() );
log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true);
}
@ -1161,7 +1161,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
);
}
catch( TimeLimitedCollector.TimeExceededException x ) {
log.warning( "Query: " + query + "; " + x.getMessage() );
log.warn( "Query: " + query + "; " + x.getMessage() );
qr.setPartialResults(true);
}
@ -1510,7 +1510,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
*/
public void warm(SolrIndexSearcher old) throws IOException {
// Make sure this is first! filters can help queryResults execute!
boolean logme = log.isLoggable(Level.INFO);
boolean logme = log.isInfoEnabled();
long warmingStartTime = System.currentTimeMillis();
// warm the caches in order...
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);
} catch (IOException e) {
// 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;
}
@ -251,7 +251,7 @@ public class FileFloatSource extends ValueSource {
fval=Float.parseFloat(val);
} catch (Exception e) {
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.")
);
}
@ -325,7 +325,7 @@ public class FileFloatSource extends ValueSource {
}
} catch (IOException e) {
// log, use defaults
SolrCore.log.severe("Error loading external value source: " +e);
SolrCore.log.error("Error loading external value source: " +e);
} finally {
// swallow exceptions on close so we don't override any
// exceptions that happened in the loop

View File

@ -23,7 +23,8 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
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.WhitespaceAnalyzer;
@ -52,7 +53,7 @@ import org.apache.solr.schema.FieldType;
* @since solr 1.3
*/
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 LOCATION = "sourceLocation";
@ -120,7 +121,7 @@ public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker {
analyzer = fieldType.getQueryAnalyzer();
}
if (analyzer == null) {
LOG.info("Using WhitespaceAnalzyer for dictionary: " + name);
log.info("Using WhitespaceAnalzyer for dictionary: " + name);
analyzer = new WhitespaceAnalyzer();
}
return name;

View File

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

View File

@ -28,7 +28,8 @@ import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.util.HighFrequencyDictionary;
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
**/
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";

View File

@ -21,7 +21,6 @@ import org.apache.lucene.search.*;
import org.apache.lucene.document.Document;
import java.util.List;
import java.util.logging.Level;
import java.io.IOException;
import java.net.URL;
@ -45,7 +44,7 @@ public class OldRequestHandler implements SolrRequestHandler {
long numErrors;
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.regex.Pattern;
import java.util.logging.Logger;
import java.util.logging.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URL;
import org.apache.solr.util.OpenBitSet;
@ -45,10 +45,10 @@ import org.apache.solr.request.SolrQueryResponse;
*/
@Deprecated
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) {
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

View File

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

View File

@ -25,7 +25,8 @@ import org.apache.lucene.store.*;
import org.apache.solr.common.SolrException;
import org.apache.solr.schema.IndexSchema;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/**
@ -37,13 +38,13 @@ import java.io.IOException;
public class SolrIndexWriter extends IndexWriter {
private static Logger log = Logger.getLogger(SolrIndexWriter.class.getName());
private static Logger log = LoggerFactory.getLogger(SolrIndexWriter.class);
String name;
IndexSchema schema;
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.schema = schema;
setSimilarity(schema.getSimilarity());
@ -83,7 +84,7 @@ public class SolrIndexWriter extends IndexWriter {
String rawLockType = (null == config) ? null : config.lockType;
if (null == rawLockType) {
// 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";
}
final String lockType = rawLockType.toLowerCase().trim();
@ -98,7 +99,7 @@ public class SolrIndexWriter extends IndexWriter {
d.setLockFactory(new SingleInstanceLockFactory());
} else if ("none".equals(lockType)) {
// 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());
} else {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
@ -149,7 +150,7 @@ public class SolrIndexWriter extends IndexWriter {
*/
public void close() throws IOException {
log.fine("Closing Writer " + name);
log.debug("Closing Writer " + name);
super.close();
}

View File

@ -26,7 +26,8 @@ import org.apache.lucene.search.HitCollector;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Vector;
import java.io.IOException;
@ -50,7 +51,7 @@ import javax.xml.xpath.XPathConstants;
*/
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 IndexSchema schema;

View File

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

View File

@ -18,7 +18,8 @@
package org.apache.solr.update.processor;
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.CommitUpdateCommand;
@ -38,7 +39,7 @@ import org.apache.solr.update.DeleteUpdateCommand;
* @since solr 1.3
*/
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;

View File

@ -19,7 +19,8 @@ package org.apache.solr.util;
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
@ -29,7 +30,7 @@ import java.util.logging.Logger;
@Deprecated
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 */
@ -84,7 +85,7 @@ public class CommonParams implements org.apache.solr.common.params.CommonParams
if (tmp instanceof String) {
fl = tmp.toString();
} 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) {
df = tmp.toString();
} 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) {
debugQuery = tmp.toString();
} 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) {
explainOther = tmp.toString();
} 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;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.solr.common.util.NamedList;
@ -28,7 +29,7 @@ import org.apache.solr.common.util.NamedList;
@Deprecated
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
@ -104,7 +105,7 @@ public class DisMaxParams extends CommonParams implements org.apache.solr.common
if (tmp instanceof Float) {
tiebreaker = ((Float)tmp).floatValue();
} 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) {
qf = tmp.toString();
} 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) {
pf = tmp.toString();
} 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) {
mm = tmp.toString();
} 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) {
pslop = ((Integer)tmp).intValue();
} 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) {
bq = tmp.toString();
} 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) {
bf = tmp.toString();
} 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) {
fq = tmp.toString();
} 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.util.*;
import java.util.logging.Level;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
/**
* <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,
* 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;
}

View File

@ -19,7 +19,8 @@ package org.apache.solr.util.plugin;
import java.util.ArrayList;
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.SolrException;
@ -37,7 +38,7 @@ import org.w3c.dom.NodeList;
*/
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 boolean preRegister;

View File

@ -19,8 +19,8 @@ package org.apache.solr.util.xslt;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
@ -51,11 +51,11 @@ public class TransformerProvider {
/** singleton */
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
// once cacheLifetimeSeconds expires
log.warning(
log.warn(
"The TransformerProvider's simplistic XSLT caching mechanism is not appropriate "
+ "for high load scenarios, unless a single XSLT transform is used"
+ " 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.
// 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(log.isLoggable(Level.FINE)) {
log.fine("Using cached Templates:" + filename);
if(log.isDebugEnabled()) {
log.debug("Using cached Templates:" + filename);
}
} else {
lastTemplates = getTemplates(solrConfig.getResourceLoader(), filename,cacheLifetimeSeconds);
@ -81,7 +81,7 @@ public class TransformerProvider {
try {
result = lastTemplates.newTransformer();
} catch(TransformerConfigurationException tce) {
log.throwing(getClass().getName(), "getTransformer", tce);
log.error(getClass().getName(), "getTransformer", tce);
final IOException ioe = new IOException("newTransformer fails ( " + lastFilename + ")");
ioe.initCause(tce);
throw ioe;
@ -96,13 +96,13 @@ public class TransformerProvider {
Templates result = null;
lastFilename = null;
try {
if(log.isLoggable(Level.FINE)) {
log.fine("compiling XSLT templates:" + filename);
if(log.isDebugEnabled()) {
log.debug("compiling XSLT templates:" + filename);
}
final InputStream xsltStream = loader.openResource("xslt/" + filename);
result = tFactory.newTemplates(new StreamSource(xsltStream));
} 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 + "'");
ioe.initCause(e);
throw ioe;

View File

@ -21,8 +21,8 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.WeakHashMap;
import java.util.logging.Logger;
import java.util.logging.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@ -47,7 +47,7 @@ import org.apache.solr.servlet.cache.Method;
*/
public class SolrDispatchFilter implements Filter
{
final Logger log = Logger.getLogger(SolrDispatchFilter.class.getName());
final Logger log = LoggerFactory.getLogger(SolrDispatchFilter.class);
protected CoreContainer cores;
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 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 );
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) {
sendError( (HttpServletResponse)response, ex );
@ -320,7 +320,7 @@ public class SolrDispatchFilter implements Filter
// non standard codes have undefined results with various servers
if( code < 100 ) {
log.warning( "invalid return code: "+code );
log.warn( "invalid return code: "+code );
code = 500;
}
}

View File

@ -29,7 +29,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
@ -51,7 +52,7 @@ import org.apache.solr.request.SolrQueryRequestBase;
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?
public static final String MULTIPART = "multipart";

View File

@ -20,7 +20,8 @@ package org.apache.solr.servlet;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@ -44,7 +45,7 @@ import org.apache.solr.request.SolrRequestHandler;
@Deprecated
public class SolrServlet extends HttpServlet {
final Logger log = Logger.getLogger(SolrServlet.class.getName());
final Logger log = LoggerFactory.getLogger(SolrServlet.class);
private boolean hasMulticore = false;
public void init() throws ServletException {
@ -78,7 +79,7 @@ public class SolrServlet extends HttpServlet {
SolrRequestHandler handler = core.getRequestHandler(solrReq.getQueryType());
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);
}
core.execute(handler, solrReq, solrRsp );

View File

@ -19,7 +19,8 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@ -38,7 +39,7 @@ import org.apache.solr.request.XMLResponseWriter;
*/
@Deprecated
public class SolrUpdateServlet extends HttpServlet {
final Logger log = Logger.getLogger(SolrUpdateServlet.class.getName());
final Logger log = LoggerFactory.getLogger(SolrUpdateServlet.class);
XmlUpdateRequestHandler legacyUpdateHandler;
XMLResponseWriter xmlResponseWriter;
@ -69,7 +70,7 @@ public class SolrUpdateServlet extends HttpServlet {
response.setContentType(QueryResponseWriter.CONTENT_TYPE_XML_UTF8);
if( request.getQueryString() != null ) {
log.warning(
log.warn(
"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"
+" Add: <requestHandler name=\"/update\" class=\"solr.XmlUpdateRequestHandler\" > to your solrconfig.xml\n\n" );