本文整理了Java中ch.qos.logback.classic.Logger.isEnabledFor()
方法的一些代码示例,展示了Logger.isEnabledFor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.isEnabledFor()
方法的具体详情如下:
包路径:ch.qos.logback.classic.Logger
类名称:Logger
方法名:isEnabledFor
暂无
代码示例来源:origin: ch.qos.logback/logback-classic
public boolean isEnabledFor(Level level) {
return isEnabledFor(null, level);
}
代码示例来源:origin: dropwizard/dropwizard
@Override
protected final boolean isEnabled() {
return log.isEnabledFor(level);
}
代码示例来源:origin: ch.qos.logback/logback-classic
private void dispatchEvents(LoggerContext lc) {
ObjectInputStream ois = null;
try {
socket.setSoTimeout(acceptConnectionTimeout);
ois = new HardenedLoggingEventInputStream(socket.getInputStream());
socket.setSoTimeout(0);
addInfo(receiverId + "connection established");
while (true) {
ILoggingEvent event = (ILoggingEvent) ois.readObject();
Logger remoteLogger = lc.getLogger(event.getLoggerName());
if (remoteLogger.isEnabledFor(event.getLevel())) {
remoteLogger.callAppenders(event);
}
}
} catch (EOFException ex) {
addInfo(receiverId + "end-of-stream detected");
} catch (IOException ex) {
addInfo(receiverId + "connection failed: " + ex);
} catch (ClassNotFoundException ex) {
addInfo(receiverId + "unknown event class: " + ex);
} finally {
CloseUtil.closeQuietly(ois);
CloseUtil.closeQuietly(socket);
socket = null;
addInfo(receiverId + "connection closed");
}
}
代码示例来源:origin: ch.qos.logback/logback-classic
if (remoteLogger.isEnabledFor(event.getLevel())) {
代码示例来源:origin: ch.qos.logback/logback-classic
if (remoteLogger.isEnabledFor(event.getLevel())) {
代码示例来源:origin: camunda/camunda-bpm-platform
public boolean isEnabledFor(Level level) {
return isEnabledFor(null, level);
}
代码示例来源:origin: camunda/camunda-bpm-platform
private void dispatchEvents(LoggerContext lc) {
try {
socket.setSoTimeout(acceptConnectionTimeout);
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
socket.setSoTimeout(0);
addInfo(receiverId + "connection established");
while (true) {
ILoggingEvent event = (ILoggingEvent) ois.readObject();
Logger remoteLogger = lc.getLogger(event.getLoggerName());
if (remoteLogger.isEnabledFor(event.getLevel())) {
remoteLogger.callAppenders(event);
}
}
} catch (EOFException ex) {
addInfo(receiverId + "end-of-stream detected");
} catch (IOException ex) {
addInfo(receiverId + "connection failed: " + ex);
} catch (ClassNotFoundException ex) {
addInfo(receiverId + "unknown event class: " + ex);
} finally {
CloseUtil.closeQuietly(socket);
socket = null;
addInfo(receiverId + "connection closed");
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
if (remoteLogger.isEnabledFor(event.getLevel())) {
代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand
public boolean isEnabledFor(Level level) {
return isEnabledFor(null, level);
}
代码示例来源:origin: camunda/camunda-bpm-platform
if (remoteLogger.isEnabledFor(event.getLevel())) {
代码示例来源:origin: io.dropwizard/dropwizard-jdbi
@Override
protected final boolean isEnabled() {
return log.isEnabledFor(level);
}
代码示例来源:origin: tony19/logback-android
public boolean isEnabledFor(Level level) {
return isEnabledFor(null, level);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public boolean isEnabledFor(Level level) {
return isEnabledFor(null, level);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
public boolean isEnabledFor(Level level) {
return isEnabledFor(null, level);
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
@Override
public boolean shouldLog(int level, String category) {
if (category == null)
return false;
Level logbackLevel = levels.get(level);
if (logbackLevel == null)
return false;
Logger log = getLog(category);
return log.isEnabledFor(logbackLevel);
}
}
代码示例来源:origin: org.ow2.chameleon/chameleon-core
/**
* Checks whether or not the given level is currently 'loggable'.
*
* @param level the level to check
* @return {@code true} if the given level is higher of equal to the current log level, {@code false} otherwise
*/
@Override
public boolean isLoggable(final java.util.logging.Level level) {
return this.logger.isEnabledFor(JulLevels.toSlf4J(level));
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-devops
@Override
public boolean setLogLevel(@Nonnull final LoggerConfig loggerConfig) {
final Level level = Level.valueOf(loggerConfig.getLevel().getIdentifier());
final String loggerName = loggerConfig.getLogger().orElse(Logger.ROOT_LOGGER_NAME);
final Logger logger = (Logger) LoggerFactory.getLogger(loggerName);
logger.setLevel(level);
return logger.isEnabledFor(level);
}
代码示例来源:origin: eclipse/ditto
@Override
public boolean setLogLevel(@Nonnull final LoggerConfig loggerConfig) {
final Level level = Level.valueOf(loggerConfig.getLevel().getIdentifier());
final String loggerName = loggerConfig.getLogger().orElse(Logger.ROOT_LOGGER_NAME);
final Logger logger = (Logger) LoggerFactory.getLogger(loggerName);
logger.setLevel(level);
return logger.isEnabledFor(level);
}
代码示例来源:origin: tony19/logback-android
@Test
public void testIsEnabledForWithNoFilter() {
addNoFilter();
logger.setLevel(Level.DEBUG);
assertFalse(logger.isEnabledFor(Level.INFO));
}
代码示例来源:origin: tony19/logback-android
@Test
public void testIsEnabledForWithYesFilter() {
addYesFilter();
logger.setLevel(Level.ERROR);
assertTrue(logger.isEnabledFor(Level.INFO));
}
内容来源于网络,如有侵权,请联系作者删除!