mirror of https://github.com/apache/lucene.git
Merged revision(s) 1670522 from lucene/dev/branches/branch_5x:
SOLR-7329: show core in logging UI ........ git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1670523 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
02b8907124
commit
183c5dd933
|
@ -90,6 +90,7 @@ import org.apache.solr.handler.RequestHandlerBase;
|
||||||
import org.apache.solr.handler.admin.ShowFileRequestHandler;
|
import org.apache.solr.handler.admin.ShowFileRequestHandler;
|
||||||
import org.apache.solr.handler.component.HighlightComponent;
|
import org.apache.solr.handler.component.HighlightComponent;
|
||||||
import org.apache.solr.handler.component.SearchComponent;
|
import org.apache.solr.handler.component.SearchComponent;
|
||||||
|
import org.apache.solr.logging.MDCUtils;
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
import org.apache.solr.request.SolrRequestHandler;
|
import org.apache.solr.request.SolrRequestHandler;
|
||||||
import org.apache.solr.response.BinaryResponseWriter;
|
import org.apache.solr.response.BinaryResponseWriter;
|
||||||
|
@ -691,6 +692,8 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
|
||||||
public SolrCore(String name, String dataDir, SolrConfig config, IndexSchema schema, CoreDescriptor cd, UpdateHandler updateHandler, IndexDeletionPolicyWrapper delPolicy, SolrCore prev) {
|
public SolrCore(String name, String dataDir, SolrConfig config, IndexSchema schema, CoreDescriptor cd, UpdateHandler updateHandler, IndexDeletionPolicyWrapper delPolicy, SolrCore prev) {
|
||||||
coreDescriptor = cd;
|
coreDescriptor = cd;
|
||||||
this.setName( name );
|
this.setName( name );
|
||||||
|
MDCUtils.setCore(name); // show the core name in the error logs
|
||||||
|
|
||||||
resourceLoader = config.getResourceLoader();
|
resourceLoader = config.getResourceLoader();
|
||||||
this.solrConfig = config;
|
this.solrConfig = config;
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class LoggingHandler extends RequestHandlerBase implements SolrCoreAware
|
||||||
SimpleOrderedMap<Object> info = new SimpleOrderedMap<>();
|
SimpleOrderedMap<Object> info = new SimpleOrderedMap<>();
|
||||||
if(time>0) {
|
if(time>0) {
|
||||||
info.add("since", time);
|
info.add("since", time);
|
||||||
info.add("found", found);
|
info.add("found", found.get());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
info.add("levels", watcher.getAllLevels()); // show for the first request
|
info.add("levels", watcher.getAllLevels()); // show for the first request
|
||||||
|
|
|
@ -16,19 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.solr.logging.log4j;
|
package org.apache.solr.logging.log4j;
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import org.apache.log4j.AppenderSkeleton;
|
|
||||||
import org.apache.log4j.Level;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.apache.log4j.spi.LoggingEvent;
|
|
||||||
import org.apache.log4j.spi.ThrowableInformation;
|
|
||||||
import org.apache.solr.common.SolrDocument;
|
|
||||||
import org.apache.solr.logging.CircularList;
|
|
||||||
import org.apache.solr.logging.ListenerConfig;
|
|
||||||
import org.apache.solr.logging.LogWatcher;
|
|
||||||
import org.apache.solr.logging.LoggerInfo;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -37,6 +24,20 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.log4j.AppenderSkeleton;
|
||||||
|
import org.apache.log4j.Level;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.apache.log4j.spi.LoggingEvent;
|
||||||
|
import org.apache.log4j.spi.ThrowableInformation;
|
||||||
|
import org.apache.solr.common.SolrDocument;
|
||||||
|
import org.apache.solr.common.cloud.ZkStateReader;
|
||||||
|
import org.apache.solr.logging.CircularList;
|
||||||
|
import org.apache.solr.logging.ListenerConfig;
|
||||||
|
import org.apache.solr.logging.LogWatcher;
|
||||||
|
import org.apache.solr.logging.LoggerInfo;
|
||||||
|
|
||||||
|
import com.google.common.base.Throwables;
|
||||||
|
|
||||||
public class Log4jWatcher extends LogWatcher<LoggingEvent> {
|
public class Log4jWatcher extends LogWatcher<LoggingEvent> {
|
||||||
|
|
||||||
final String name;
|
final String name;
|
||||||
|
@ -157,6 +158,12 @@ public class Log4jWatcher extends LogWatcher<LoggingEvent> {
|
||||||
if(t!=null) {
|
if(t!=null) {
|
||||||
doc.setField("trace", Throwables.getStackTraceAsString(t.getThrowable()));
|
doc.setField("trace", Throwables.getStackTraceAsString(t.getThrowable()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Will be null if not present
|
||||||
|
doc.setField("core", event.getMDC(ZkStateReader.CORE_NAME_PROP));
|
||||||
|
doc.setField("collection", event.getMDC(ZkStateReader.COLLECTION_PROP));
|
||||||
|
doc.setField("replica", event.getMDC(ZkStateReader.REPLICA_PROP));
|
||||||
|
doc.setField("shard", event.getMDC(ZkStateReader.SHARD_ID_PROP));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -361,6 +361,7 @@ var load_logging_viewer = function()
|
||||||
content += '<tr class="' + classes.join( ' ' ) + '">' + "\n";
|
content += '<tr class="' + classes.join( ' ' ) + '">' + "\n";
|
||||||
content += '<td class="span"><a><span>' + format_time( doc.time ) + '</span></a></td>' + "\n";
|
content += '<td class="span"><a><span>' + format_time( doc.time ) + '</span></a></td>' + "\n";
|
||||||
content += '<td class="level span"><a><span>' + doc.level.esc() + '</span></span></a></td>' + "\n";
|
content += '<td class="level span"><a><span>' + doc.level.esc() + '</span></span></a></td>' + "\n";
|
||||||
|
content += '<td class="span"><a><span>' + doc.core + '</span></a></td>' + "\n";
|
||||||
content += '<td class="span"><a><span>' + doc.logger + '</span></a></td>' + "\n";
|
content += '<td class="span"><a><span>' + doc.logger + '</span></a></td>' + "\n";
|
||||||
content += '<td class="message span"><a><span>' + doc.message.replace( /,/g, ',​' ).esc() + '</span></a></td>' + "\n";
|
content += '<td class="message span"><a><span>' + doc.message.replace( /,/g, ',​' ).esc() + '</span></a></td>' + "\n";
|
||||||
content += '</tr>' + "\n";
|
content += '</tr>' + "\n";
|
||||||
|
@ -433,6 +434,7 @@ sammy.get
|
||||||
'<tr>' + "\n" +
|
'<tr>' + "\n" +
|
||||||
'<th class="time">Time (<span>Local</span>)</th>' + "\n" +
|
'<th class="time">Time (<span>Local</span>)</th>' + "\n" +
|
||||||
'<th class="level">Level</th>' + "\n" +
|
'<th class="level">Level</th>' + "\n" +
|
||||||
|
'<th class="core">Core</th>' + "\n" +
|
||||||
'<th class="logger">Logger</th>' + "\n" +
|
'<th class="logger">Logger</th>' + "\n" +
|
||||||
'<th class="message">Message</th>' + "\n" +
|
'<th class="message">Message</th>' + "\n" +
|
||||||
'</tr>' + "\n" +
|
'</tr>' + "\n" +
|
||||||
|
|
Loading…
Reference in New Issue