improve logging

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1428695 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2013-01-04 01:15:17 +00:00
parent c7d8852051
commit 7e57636e39
3 changed files with 21 additions and 9 deletions

View File

@ -44,7 +44,19 @@ public abstract class UpdateCommand implements Cloneable {
@Override
public String toString() {
return name() + "{flags="+flags+",_version_="+version;
StringBuilder sb = new StringBuilder(50);
sb.append(name());
sb.append('{');
boolean needComma = false;
if (flags != 0) {
sb.append("flags=").append(Integer.toHexString(flags));
needComma = true;
}
if (version != 0) {
if (needComma) sb.append(',');
sb.append("_version_=").append(version);
}
return sb.toString();
}
public long getVersion() {

View File

@ -94,7 +94,7 @@ class LogUpdateProcessor extends UpdateRequestProcessor {
@Override
public void processAdd(AddUpdateCommand cmd) throws IOException {
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString()); }
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString() + " " + req); }
// call delegate first so we can log things like the version that get set later
if (next != null) next.processAdd(cmd);
@ -117,7 +117,7 @@ class LogUpdateProcessor extends UpdateRequestProcessor {
@Override
public void processDelete( DeleteUpdateCommand cmd ) throws IOException {
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString()); }
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString() + " " + req); }
if (next != null) next.processDelete(cmd);
if (cmd.isDeleteById()) {
@ -145,7 +145,7 @@ class LogUpdateProcessor extends UpdateRequestProcessor {
@Override
public void processMergeIndexes(MergeIndexesCommand cmd) throws IOException {
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString()); }
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString() + " " + req); }
if (next != null) next.processMergeIndexes(cmd);
toLog.add("mergeIndexes", cmd.toString());
@ -153,7 +153,7 @@ class LogUpdateProcessor extends UpdateRequestProcessor {
@Override
public void processCommit( CommitUpdateCommand cmd ) throws IOException {
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString()); }
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString() + " " + req); }
if (next != null) next.processCommit(cmd);
@ -166,7 +166,7 @@ class LogUpdateProcessor extends UpdateRequestProcessor {
*/
@Override
public void processRollback( RollbackUpdateCommand cmd ) throws IOException {
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString()); }
if (logDebug) { log.debug("PRE_UPDATE " + cmd.toString() + " " + req); }
if (next != null) next.processRollback(cmd);
toLog.add("rollback", "");
@ -175,7 +175,7 @@ class LogUpdateProcessor extends UpdateRequestProcessor {
@Override
public void finish() throws IOException {
if (logDebug) { log.debug("PRE_UPDATE finish()"); }
if (logDebug) { log.debug("PRE_UPDATE FINISH " + req); }
if (next != null) next.finish();
// LOG A SUMMARY WHEN ALL DONE (INFO LEVEL)

View File

@ -7,8 +7,8 @@ java.util.logging.ConsoleHandler.formatter=org.apache.solr.SolrLogFormatter
#.level=SEVERE
.level=INFO
#org.apache.solr.update.processor.LogUpdateProcessor=FINEST
#org.apache.solr.update.processor.DistributedUpdateProcessor=FINEST
#org.apache.solr.update.processor.LogUpdateProcessor.level=FINEST
#org.apache.solr.update.processor.DistributedUpdateProcessor.level=FINEST
#org.apache.solr.update.PeerSync.level=FINEST
#org.apache.solr.core.CoreContainer.level=FINEST
#org.apache.solr.cloud.RecoveryStrategy.level=FINEST