本文整理了Java中org.apache.logging.log4j.core.Logger.get()
方法的一些代码示例,展示了Logger.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.get()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Logger
类名称:Logger
方法名:get
[英]This method is not exposed through the public API and is used primarily for unit testing.
[中]此方法不通过公共API公开,主要用于单元测试。
代码示例来源:origin: apache/geode
public static LoggerConfig getLoggerConfig(final org.apache.logging.log4j.Logger logger) {
return ((Logger) logger).get();
}
代码示例来源:origin: DimensionalDevelopment/VanillaFix
/** Modifies the log4j config to add the policy **/
public static void install() {
Logger rootLogger = (Logger) LogManager.getRootLogger();
LoggerConfig loggerConfig = rootLogger.get();
// Remove appender refs from config
List<AppenderRef> appenderRefs = new ArrayList<>(loggerConfig.getAppenderRefs());
for (AppenderRef appenderRef : appenderRefs) {
loggerConfig.removeAppender(appenderRef.getRef());
}
// Create the RewriteAppender, which wraps the appenders
RewriteAppender rewriteAppender = RewriteAppender.createAppender(
"VanillaFixDeobfuscatingAppender",
"true",
appenderRefs.toArray(new AppenderRef[0]),
rootLogger.getContext().getConfiguration(),
new DeobfuscatingRewritePolicy(),
null
);
rewriteAppender.start();
// Add the new appender
loggerConfig.addAppender(rewriteAppender, null, null);
}
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
((AsyncLoggerConfig)((org.apache.logging.log4j.core.Logger) log).get()).callAppenders(event);
for (int j = 0; j < 3000; j++) {
map.remove(String.valueOf(j));
代码示例来源:origin: apache/hive
LoggerConfig loggerConfig = coreLogger.get();
Map<String, Appender> appenders = loggerConfig.getAppenders();
代码示例来源:origin: org.apache.logging.log4j/log4j-core
static long asyncRemainingCapacity(Logger logger) {
if (logger instanceof AsyncLogger) {
try {
Field f = field(AsyncLogger.class, "loggerDisruptor");
return ((AsyncLoggerDisruptor) f.get(logger)).getDisruptor().getRingBuffer().remainingCapacity();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} else {
LoggerConfig loggerConfig = ((org.apache.logging.log4j.core.Logger) logger).get();
if (loggerConfig instanceof AsyncLoggerConfig) {
try {
Object delegate = field(AsyncLoggerConfig.class, "delegate").get(loggerConfig);
return ((Disruptor) field(AsyncLoggerConfigDisruptor.class, "disruptor").get(delegate)).getRingBuffer().remainingCapacity();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} else {
Appender async = loggerConfig.getAppenders().get("async");
if (async instanceof AsyncAppender) {
return ((AsyncAppender) async).getQueueCapacity();
}
}
}
throw new IllegalStateException("Neither Async Loggers nor AsyncAppender are configured");
}
private static Field field(Class<?> c, String name) throws NoSuchFieldException {
代码示例来源:origin: org.apache.logging.log4j/log4j-core
ring = ((AsyncLoggerContext) loggerContext).createRingBufferAdmin();
} else {
ring = ((AsyncLoggerConfig) ((org.apache.logging.log4j.core.Logger) log).get()).createRingBufferAdmin("");
内容来源于网络,如有侵权,请联系作者删除!