當前位置: 首頁>>代碼示例>>Java>>正文


Java LogEvent.getLevel方法代碼示例

本文整理匯總了Java中org.apache.logging.log4j.core.LogEvent.getLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java LogEvent.getLevel方法的具體用法?Java LogEvent.getLevel怎麽用?Java LogEvent.getLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.logging.log4j.core.LogEvent的用法示例。


在下文中一共展示了LogEvent.getLevel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: append

import org.apache.logging.log4j.core.LogEvent; //導入方法依賴的package包/類
@Override
public void append(LogEvent event) {
    Level level = event.getLevel();
    if (TRACE.equals(level)) {
        TRACE_LABEL.inc();
    } else if (DEBUG.equals(level)) {
        DEBUG_LABEL.inc();
    } else if (INFO.equals(level)) {
        INFO_LABEL.inc();
    } else if (WARN.equals(level)) {
        WARN_LABEL.inc();
    } else if (ERROR.equals(level)) {
        ERROR_LABEL.inc();
    } else if (FATAL.equals(level)) {
        FATAL_LABEL.inc();
    }
}
 
開發者ID:AndreyVMarkelov,項目名稱:jira-prometheus-exporter,代碼行數:18,代碼來源:InstrumentedAppender.java

示例2: append

import org.apache.logging.log4j.core.LogEvent; //導入方法依賴的package包/類
@Override
public void append(LogEvent event) {
    final String formattedMessage = event.getMessage().getFormattedMessage();
    if (event.getLevel() == Level.TRACE && event.getMarker().getName().contains("[index][1] ")) {
        if (event.getLoggerName().endsWith(".IW") &&
            formattedMessage.contains("IW: apply all deletes during flush")) {
            sawIndexWriterMessage = true;
        }
        if (event.getLoggerName().endsWith(".IFD")) {
            sawIndexWriterIFDMessage = true;
        }
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:14,代碼來源:InternalEngineTests.java

示例3: append

import org.apache.logging.log4j.core.LogEvent; //導入方法依賴的package包/類
@Override
public void append(LogEvent event) {
    String message = event.getMessage().getFormattedMessage();
    if (event.getLevel() == Level.TRACE && event.getLoggerName().endsWith("lucene.iw")) {
    }
    if (event.getLevel() == Level.INFO
        && message.contains("updating [index.merge.scheduler.max_thread_count] from [10000] to [1]")) {
        sawUpdateMaxThreadCount = true;
    }
    if (event.getLevel() == Level.INFO
        && message.contains("updating [index.merge.scheduler.auto_throttle] from [true] to [false]")) {
        sawUpdateAutoThrottle = true;
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:15,代碼來源:MergeSchedulerSettingsTests.java

示例4: toSerializable

import org.apache.logging.log4j.core.LogEvent; //導入方法依賴的package包/類
public String toSerializable(LogEvent event) {
	StringBuilder builder = new StringBuilder();
	
       builder.append(OBJ_S);
       addField(builder,"@timestamp",ISO_DATETIME_TIME_ZONE_FORMAT_WITH_MILLIS.format(event.getTimeMillis()));
       
       if(event!=null){
        addField(builder,"logger_name", event.getLoggerName());
        
        if(event.getLevel()!=null){
        	addField(builder,"level", event.getLevel().name());
        	addField(builder,"level_int", event.getLevel().intLevel());
        }
        
        addField(builder,"thread_name", event.getThreadName());
        addField(builder,"source_host", getHostName());
        addField(builder,"source_ip", getHostIP());
        
        if(event.getMessage()!=null){
        	addField(builder,"message", event.getMessage().getFormattedMessage());
        }
        
        if (event.getThrown() !=null){
        	addField(builder,"exception",event.getThrown());
        }
        
        if (locationInfo) {
        	 addField(builder,"file",event.getSource().getFileName());
        	 addField(builder,"line_number",event.getSource().getLineNumber());
        	 addField(builder,"class",event.getSource().getClassName());
        	 addField(builder,"method",event.getSource().getMethodName());
        }
        
        if(event.getContextStack()!=null) {
        	addField(builder,"contextStack",event.getContextStack());
        }
        
        if(event.getContextMap()!=null) {
        	if(plainContextMap){
        		for(Entry<String,String> entry: event.getContextMap().entrySet()){
        			addField(builder,entry.getKey(),entry.getValue());
        		}
        	}else{
        		addField(builder,"contextMap",event.getContextMap());
        	}
        }
        
        if(userFields!=null){
        	for(UserField userField : userFields){
        		addField(builder,userField.getKey(),userField.getValue());
        	}
        }
       }
       addField(builder,"@version",VERSION,false);
       builder.append(OBJ_E);
       builder.append("\n");
	return builder.toString();
}
 
開發者ID:dubasdey,項目名稱:log4j2-jsonevent-layout,代碼行數:59,代碼來源:JSONLog4j2Layout.java


注:本文中的org.apache.logging.log4j.core.LogEvent.getLevel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。