本文整理汇总了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());
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
示例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));
}
}
示例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)) +
")");
}
}
示例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);
}
}
示例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);
}
}
示例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)));
}
}
示例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) : ""));
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}