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


Java Trace類代碼示例

本文整理匯總了Java中com.evolveum.midpoint.util.logging.Trace的典型用法代碼示例。如果您正苦於以下問題:Java Trace類的具體用法?Java Trace怎麽用?Java Trace使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Trace類屬於com.evolveum.midpoint.util.logging包,在下文中一共展示了Trace類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dumpCsv

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
private void dumpCsv(Trace logger, PrintWriter pw, String prefix, AggregateRecord[] data) {
    long totalTime = 0;
    int totalRecords = 0;
    if (data != null) {
        StringBuilder sb = new StringBuilder();
        sb.append(prefix);
        for (int i = 0; i < data.length; i++) {
            totalTime += data[i].totalTime;
            totalRecords += data[i].records;
            sb.append(";").append(data[i].records);
        }
        sb.append(";").append(totalRecords);
        sb.append(";").append(totalTime);
        sb.append(";");
        if (totalRecords > 0) {
            sb.append(totalTime/totalRecords);
        } else {
            sb.append("0");
        }
        logger.info(sb.toString());
        pw.println(sb.toString());
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:24,代碼來源:OrgClosureStatistics.java

示例2: dumpText

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
private void dumpText(Trace logger, String label, AggregateRecord[] data, AggregateRecord total) {
    long totalTime = 0;
    int totalRecords = 0;
    if (data != null) {
        for (int i = 0; i < data.length; i++) {
            totalTime += data[i].totalTime;
            totalRecords += data[i].records;
        }
        total.totalTime += totalTime;
        total.records += totalRecords;
    }
    logger.info(" ---> {}: avg {} ms", label, totalRecords > 0 ? ((float) totalTime)/totalRecords : 0);
    if (data != null) {
        for (int i = 0; i < data.length; i++) {
            logger.info("up to {}: {}", BUCKETS[i], data[i].records);
        }
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:19,代碼來源:OrgClosureStatistics.java

示例3: recordFatalError

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static void recordFatalError(Trace logger, OperationResult opResult, String message, Throwable ex) {
	if (message == null) {
		message = ex.getMessage();
	}
	logger.error(message, ex);
	opResult.recordFatalError(message, ex);
	opResult.cleanupResult(ex);
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:9,代碼來源:ProvisioningUtil.java

示例4: log

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
@Override
public void log(Class<?> clazz, String method, Level level, String message, Throwable ex) {
	Trace LOGGER = TraceManager.getTrace(clazz);
	//Mark all messages from ICF as ICF
	Marker m = MarkerFactory.getMarker("ICF");
	
	//Translate ICF logging into slf4j
	// OK    -> trace
	// INFO  -> debug
	// WARN  -> warn
	// ERROR -> error
	if (Level.OK.equals(level)) {
		if (null == ex) {
			LOGGER.trace(m, "method: {} msg:{}", method, message);
		} else {
			LOGGER.trace(m, "method: {} msg:{}", new Object[] { method, message }, ex);
		}
	} else if (Level.INFO.equals(level)) {
		if (null == ex) {
			LOGGER.debug(m, "method: {} msg:{}", method, message);
		} else {
			LOGGER.debug(m, "method: {} msg:{}", new Object[] { method, message }, ex);
		}
	} else if (Level.WARN.equals(level)) {
		if (null == ex) {
			LOGGER.warn(m, "method: {} msg:{}", method, message);
		} else {
			LOGGER.warn(m, "method: {} msg:{}", new Object[] { method, message }, ex);
		}
	} else if (Level.ERROR.equals(level)) {
		if (null == ex) {
			LOGGER.error(m, "method: {} msg:{}", method, message);
		} else {
			LOGGER.error(m, "method: {} msg:{}", new Object[] { method, message }, ex);
		}
	}
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:38,代碼來源:Slf4jConnectorLogger.java

示例5: traceContext

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static <F extends ObjectType> void traceContext(Trace logger, String activity, String phase, 
boolean important,  LensContext<F> context, boolean showTriples) throws SchemaException {
     if (logger.isTraceEnabled()) {
     	logger.trace("Lens context:\n"+
         		"---[ {} context {} ]--------------------------------\n"+
         		"{}\n",
		activity, phase, context.dump(showTriples));
     }
 }
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:10,代碼來源:LensUtil.java

示例6: logStart

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
protected void logStart(Trace LOGGER, Event event, EventHandlerType eventHandlerType, Object additionalData) {
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Starting processing event " + event + " with handler " +
                eventHandlerType.getClass() + " (name: " + eventHandlerType.getName() +
                (additionalData != null ? (", parameters: " + additionalData) :
                                         (", configuration: " + eventHandlerType)) +
                ")");
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:10,代碼來源:BaseHelper.java

示例7: appendToFile

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static void appendToFile(String fileName, String messageText, Trace logger, OperationResult result) {
	try {
		TransportUtil.appendToFile(fileName, messageText);
		result.recordSuccess();
	} catch (Throwable t) {
		LoggingUtils.logUnexpectedException(logger, "Couldn't write the notification to a file {}", t, fileName);
		result.recordPartialError("Couldn't write the notification to a file " + fileName, t);
	}
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:10,代碼來源:TransportUtil.java

示例8: logToFile

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static void logToFile(String fileName, String messageText, Trace logger) {
	try {
		TransportUtil.appendToFile(fileName, messageText);
	} catch (Throwable t) {
		LoggingUtils.logUnexpectedException(logger, "Couldn't write the notification to a file {}", t, fileName);
	}
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:8,代碼來源:TransportUtil.java

示例9: logStart

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
protected void logStart(Trace LOGGER, Event event, EventHandlerType eventHandlerType, Object additionalData) {
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Starting processing event " + event.shortDump() + " with handler " +
        		getHumanReadableHandlerDescription(eventHandlerType) + "\n  parameters: " +
        		(additionalData != null ? ("\n  parameters: " + additionalData) :
                    ("\n  configuration: " + eventHandlerType)));
                
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:10,代碼來源:BaseHandler.java

示例10: staticLogStart

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static void staticLogStart(Trace LOGGER, Event event, String description, Object additionalData) {
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Starting processing event " + event + " with handler " +
                description +
                (additionalData != null ? (", parameters: " + additionalData) : ""));
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:8,代碼來源:BaseHandler.java

示例11: warnOrThrow

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public void warnOrThrow(Trace logger, String message, Throwable t) throws SchemaException {
	if (isCompat()) {
		logger.warn("{}", message, t);
		warn(message);
	} else {
		throw new SchemaException(message, t);
	}
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:9,代碼來源:ParsingContext.java

示例12: logAllLevels

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
private void logAllLevels(Trace logger, String subsystemName) {
	String message = MARKER+" "+subsystemName;
	String previousSubsystem = MidpointInterceptor.swapSubsystemMark(subsystemName);
	logger.trace(message);
	logger.debug(message);
	logger.info(message);
	logger.warn(message);
	logger.error(message);
	MidpointInterceptor.swapSubsystemMark(previousSubsystem);
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:11,代碼來源:LogfileTestTailer.java

示例13: enter

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static <T extends AbstractCache> T enter(ThreadLocal<T> cacheThreadLocal, Class<T> cacheClass, Trace logger) {
    T inst = cacheThreadLocal.get();
    logger.trace("Cache: ENTER for thread {}, {}", Thread.currentThread().getName(), inst);
    if (inst == null) {
        logger.trace("Cache: creating for thread {}",Thread.currentThread().getName());
        try {
            inst = cacheClass.newInstance();
        } catch (InstantiationException|IllegalAccessException e) {
            throw new SystemException("Couldn't instantiate cache: " + e.getMessage(), e);
        }
        cacheThreadLocal.set(inst);
    }
    inst.incrementEntryCount();
    return inst;
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:16,代碼來源:AbstractCache.java

示例14: exit

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static <T extends AbstractCache> T exit(ThreadLocal<T> cacheThreadLocal, Trace logger) {
    T inst = cacheThreadLocal.get();
    logger.trace("Cache: EXIT for thread {}, {}", Thread.currentThread().getName(), inst);
    if (inst == null || inst.getEntryCount() == 0) {
        logger.error("Cache: Attempt to exit cache that does not exist or has entry count 0: {}", inst);
        cacheThreadLocal.set(null);
    } else {
        inst.decrementEntryCount();
        if (inst.getEntryCount() <= 0) {
            destroy(cacheThreadLocal, logger);
        }
    }
    return inst;
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:15,代碼來源:AbstractCache.java

示例15: destroy

import com.evolveum.midpoint.util.logging.Trace; //導入依賴的package包/類
public static <T extends AbstractCache> void destroy(ThreadLocal<T> cacheThreadLocal, Trace logger) {
    T inst = cacheThreadLocal.get();
    if (inst != null) {
        logger.trace("Cache: DESTROY for thread {}", Thread.currentThread().getName());
        cacheThreadLocal.set(null);
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:8,代碼來源:AbstractCache.java


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