本文整理汇总了Java中java.util.logging.Level.OFF属性的典型用法代码示例。如果您正苦于以下问题:Java Level.OFF属性的具体用法?Java Level.OFF怎么用?Java Level.OFF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.util.logging.Level
的用法示例。
在下文中一共展示了Level.OFF属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerBuffer
public static Test registerBuffer(Level msg, Level exc) {
if (msg == null) {
msg = Level.OFF;
}
if (exc == null) {
exc = Level.OFF;
}
if (exc == Level.OFF && msg == Level.OFF) {
return null;
}
NbModuleLogHandler.msg = msg;
NbModuleLogHandler.exc = exc;
NbModuleLogHandler.text = new StringBuffer();
Logger l = Logger.getLogger("");
Level min = msg;
if (min.intValue() > exc.intValue()) {
min = exc;
}
l.setLevel(min);
return new FailOnException(msg, exc);
}
示例2: getLogLevel
static private Level getLogLevel(int level) {
switch (level) {
case 0:
return Level.OFF;
case 1:
return Level.WARNING;
case 2:
return Level.INFO;
case 3:
return Level.FINE;
case 4:
return Level.FINER;
case 9:
return Level.ALL;
default:
return Level.FINEST;
}
}
示例3: getLog
/**
* Access log for a tri-state system property.
*
* Need to first convert override value to a log level, taking
* care to interpret a range of values between BRIEF, VERBOSE and
* SILENT.
*
* An override < 0 is interpreted to mean that the logging
* configuration should not be overridden. The level passed to the
* factories createLog method will be null in this case.
*
* Note that if oldLogName is null and old logging is on, the
* returned LogStreamLog will ignore the override parameter - the
* log will never log messages. This permits new logs that only
* write to Loggers to do nothing when old logging is active.
*
* Do not call getLog multiple times on the same logger name.
* Since this is an internal API, no checks are made to ensure
* that multiple logs do not exist for the same logger.
*/
public static Log getLog(String loggerName, String oldLogName,
int override)
{
Level level;
if (override < 0) {
level = null;
} else if (override == LogStream.SILENT) {
level = Level.OFF;
} else if ((override > LogStream.SILENT) &&
(override <= LogStream.BRIEF)) {
level = BRIEF;
} else if ((override > LogStream.BRIEF) &&
(override <= LogStream.VERBOSE))
{
level = VERBOSE;
} else {
level = Level.FINEST;
}
return logFactory.createLog(loggerName, oldLogName, level);
}
示例4: randomLevel
private static Level randomLevel(Random r) {
int lev = r.nextInt(1100);
if (lev >= Level.SEVERE.intValue()) return Level.SEVERE;
if (lev >= Level.WARNING.intValue()) return Level.WARNING;
if (lev >= Level.INFO.intValue()) return Level.INFO;
if (lev >= Level.CONFIG.intValue()) return Level.CONFIG;
if (lev >= Level.FINE.intValue()) return Level.FINE;
if (lev >= Level.FINER.intValue()) return Level.FINER;
if (lev >= Level.FINEST.intValue()) return Level.FINEST;
return Level.OFF;
}
示例5: threshold
public Level threshold() {
for (Level l : LEVELS ) {
if (this.toString().endsWith(l.getName())) {
return l;
}
}
return Level.OFF;
}
示例6: close
@Override
public void close() {
Logger l = this.logger;
if (getLevel() != Level.OFF && l != null) {
l.addHandler(this);
}
}
示例7: getLogLevel
/**
* Gdx to Log4j log level mapping
*/
private static Level getLogLevel(int logLevel) {
switch (logLevel) {
case Application.LOG_NONE:
return Level.OFF;
case Application.LOG_ERROR:
return Level.SEVERE;
case Application.LOG_INFO:
return Level.INFO;
case Application.LOG_DEBUG:
return Level.FINEST;
default:
return Level.ALL;
}
}
示例8: forEnclosingClass
/** Returns a generic fluent logger for a class. */
public static FluentLogger forEnclosingClass() {
StackTraceElement caller = new Throwable().getStackTrace()[1];
Logger logger = Logger.getLogger(caller.getClassName());
logger.setUseParentHandlers(false);
logger.addHandler(new ConsoleHandler());
return new FluentLogger(logger, Level.OFF, Optional.empty());
}
示例9: log
@Override
public void log(Level level, String msg, Throwable th) {
if (level != Level.OFF) {
// That's how Log does it internally
Log.println(mapLevel(level), tag, msg + "\n" + Log.getStackTraceString(th));
}
}
示例10: logLevel
@Override
protected Level logLevel() {
return Level.OFF;
}
示例11: getLevel
@Override
public Level getLevel() {
return willLog() ? Level.FINEST : Level.OFF;
}
示例12: getLogLevel
public Level getLogLevel() {
return Level.OFF;
}
示例13: getLogLevel
protected Level getLogLevel() {
if (log.getLevel() == Level.ALL) return Level.FINEST;
if (log.getLevel() == Level.OFF) return Level.WARNING;
if (log.getLevel() == Level.CONFIG) return Level.WARNING;
return log.getLevel();
}
示例14: getLevel
/**
* Do not currently support chaining this with parent logger. Logger level null
* means disabled
* @return level
*/
public Level getLevel() {
return logger.getLevel() == null ? Level.OFF : logger.getLevel();
}