热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.logging.log4j.spi.ExtendedLogger类的使用及代码示例

本文整理了Java中org.apache.logging.log4j.spi.ExtendedLogger类的一些代码示例,展示了ExtendedLogge

本文整理了Java中org.apache.logging.log4j.spi.ExtendedLogger类的一些代码示例,展示了ExtendedLogger类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExtendedLogger类的具体详情如下:
包路径:org.apache.logging.log4j.spi.ExtendedLogger
类名称:ExtendedLogger

ExtendedLogger介绍

[英]Extends the Logger interface with methods that facilitate implementing or extending Loggers. Users should not need to use this interface.
[中]使用便于实现或扩展记录器的方法扩展记录器接口。用户不需要使用此界面。

代码示例

代码示例来源:origin: spring-projects/spring-framework

private void log(Level level, Object message, Throwable exception) {
if (message instanceof String) {
// Explicitly pass a String argument, avoiding Log4j's argument expansion
// for message objects in case of "{}" sequences (SPR-16226)
if (exception != null) {
this.logger.logIfEnabled(FQCN, level, null, (String) message, exception);
}
else {
this.logger.logIfEnabled(FQCN, level, null, (String) message);
}
}
else {
this.logger.logIfEnabled(FQCN, level, null, message, exception);
}
}
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public boolean isInfoEnabled() {
return this.logger.isEnabled(Level.INFO);
}

代码示例来源:origin: eclipse-vertx/vert.x

public boolean isDebugEnabled() {
return logger.isDebugEnabled();
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public Level getLevel() {
return logger.isTraceEnabled() ? Level.FINEST
: logger.isDebugEnabled() ? Level.FINE
: logger.isInfoEnabled() ? Level.INFO
: logger.isWarnEnabled() ? Level.WARNING
: logger.isErrorEnabled() ? Level.SEVERE
: logger.isFatalEnabled() ? Level.SEVERE
: Level.OFF;
}

代码示例来源:origin: apache/geode

/**
* FastLogger should delegate isDebugEnabled when isDelegating
*/
@Test
public void delegateIsDebugEnabledWhenIsDelegating() {
when(mockedLogger.getLevel()).thenReturn(Level.DEBUG);
when(mockedLogger.isEnabled(eq(Level.DEBUG), isNull(), isNull())).thenReturn(true);
when(mockedLogger.isEnabled(eq(Level.DEBUG), eq(mockedMarker), (Object) isNull(), isNull()))
.thenReturn(true);
assertThat(fastLogger.isDebugEnabled()).isTrue();
assertThat(fastLogger.isDebugEnabled(mockedMarker)).isTrue();
verify(mockedLogger).isEnabled(eq(Level.DEBUG), isNull(), isNull());
verify(mockedLogger).isEnabled(eq(Level.DEBUG), eq(mockedMarker), (Object) isNull(), isNull());
}

代码示例来源:origin: apache/geode

@Before
public void setUp() {
MessageFactory messageFactory = new ParameterizedMessageFactory();
mockedLogger = mock(ExtendedLogger.class);
mockedMarker = mock(Marker.class);
when(mockedLogger.getMessageFactory()).thenReturn(messageFactory);
when(mockedLogger.getName()).thenReturn(LOGGER_NAME);
when(mockedLogger.getLevel()).thenReturn(Level.INFO);
when(mockedMarker.getName()).thenReturn(MARKER_NAME);
fastLogger = new FastLogger(mockedLogger);
FastLogger.setDelegating(true);
clearInvocations(mockedLogger);
assertThat(mockedLogger.getLevel()).isEqualTo(Level.INFO);
}

代码示例来源:origin: eclipse-vertx/vert.x

public boolean isInfoEnabled() {
return logger.isInfoEnabled();
}

代码示例来源:origin: eclipse-vertx/vert.x

public boolean isTraceEnabled() {
return logger.isTraceEnabled();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-api

@Override
public Level getLevel() {
return logger.getLevel();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public boolean isWarnEnabled() {
return logger.isWarnEnabled();
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

public boolean isErrorEnabled()
{
return m_delegate.isErrorEnabled();
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public Level getLevel() {
return logger.isTraceEnabled() ? Level.FINEST
: logger.isDebugEnabled() ? Level.FINE
: logger.isInfoEnabled() ? Level.INFO
: logger.isWarnEnabled() ? Level.WARNING
: logger.isErrorEnabled() ? Level.SEVERE
: logger.isFatalEnabled() ? Level.SEVERE
: Level.OFF;
}

代码示例来源:origin: apache/geode

/**
* FastLogger should not delegate isDebugEnabled when not isDelegating
*/
@Test
public void notDelegateIsDebugEnabledWhenNotIsDelegating() {
FastLogger.setDelegating(false);
when(mockedLogger.getLevel()).thenReturn(Level.INFO);
assertThat(fastLogger.getLevel()).isEqualTo(Level.INFO);
assertThat(fastLogger.isDebugEnabled()).isFalse();
assertThat(fastLogger.isDebugEnabled(mockedMarker)).isFalse();
verify(mockedLogger, never()).isEnabled(eq(Level.DEBUG), isNull(), isNull());
verify(mockedLogger, never()).isEnabled(eq(Level.DEBUG), eq(mockedMarker), (Object) isNull(),
isNull());
}

代码示例来源:origin: io.vertx/vertx-core

public boolean isInfoEnabled() {
return logger.isInfoEnabled();
}

代码示例来源:origin: io.vertx/vertx-core

public boolean isTraceEnabled() {
return logger.isTraceEnabled();
}

代码示例来源:origin: apache/geode

/**
* FastLogger should delegate getLevel
*/
@Test
public void delegateGetLevel() {
when(mockedLogger.getLevel()).thenReturn(Level.DEBUG);
assertThat(fastLogger.getLevel()).isEqualTo(Level.DEBUG);
}

代码示例来源:origin: io.vertx/vertx-core

@Override
public boolean isWarnEnabled() {
return logger.isWarnEnabled();
}

代码示例来源:origin: eclipse-vertx/vert.x

private void log(Level level, Object message, Throwable t) {
if (message instanceof Message) {
logger.logIfEnabled(FQCN, level, null, (Message) message, t);
} else {
logger.logIfEnabled(FQCN, level, null, message, t);
}
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public boolean isFatalEnabled() {
return this.logger.isEnabled(Level.FATAL);
}

代码示例来源:origin: org.rapidpm/rapidpm-logger-adapter

@Override
public Level getLevel() {
return logger.isTraceEnabled() ? Level.FINEST
: logger.isDebugEnabled() ? Level.FINE
: logger.isInfoEnabled() ? Level.INFO
: logger.isWarnEnabled() ? Level.WARNING
: logger.isErrorEnabled() ? Level.SEVERE
: logger.isFatalEnabled() ? Level.SEVERE
: Level.OFF;
}

推荐阅读
author-avatar
Json
技术QQ交流群:294088839.
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有