Java Code Examples for java.util.logging.Level.OFF

The following are Jave code examples for showing how to use OFF of the java.util.logging.Level class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: NbModuleLogHandler.java   View Source Code Vote up 6 votes
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);
}
 
Example 2
Project: jboss-eap7.1-playground   File: AbstractLoggerMain.java   View Source Code Vote up 6 votes
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;
	}
}
 
Example 3
Project: OpenJSharp   File: Log.java   View Source Code Vote up 6 votes
/**
 * 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);
}
 
Example 4
Project: jdk8u-jdk   File: Log.java   View Source Code Vote up 6 votes
/**
 * 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);
}
 
Example 5
Project: incubator-netbeans   File: LogRecordsTest.java   View Source Code Vote up 5 votes
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;
}
 
Example 6
Project: openjdk-jdk10   File: TestIsLoggable.java   View Source Code Vote up 5 votes
public Level threshold() {
    for (Level l : LEVELS ) {
        if (this.toString().endsWith(l.getName())) {
            return l;
        }
    }
    return Level.OFF;
}
 
Example 7
Project: incubator-netbeans   File: Log.java   View Source Code Vote up 5 votes
@Override
public void close() {
    Logger l = this.logger;
    if (getLevel() != Level.OFF && l != null) {
        l.addHandler(this);
    }
}
 
Example 8
Project: jdk8u-jdk   File: TestIsLoggable.java   View Source Code Vote up 5 votes
public Level threshold() {
    for (Level l : LEVELS ) {
        if (this.toString().endsWith(l.getName())) {
            return l;
        }
    }
    return Level.OFF;
}
 
Example 9
Project: gdx-gamesvcs   File: GpgsClient.java   View Source Code Vote up 5 votes
/**
 * 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;
    }
}
 
Example 10
Project: ios-device-control   File: FluentLogger.java   View Source Code Vote up 5 votes
/** 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());
}
 
Example 11
Project: OKEventBus   File: AndroidLogger.java   View Source Code Vote up 5 votes
@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));
    }
}
 
Example 12
Project: incubator-netbeans   File: LogTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.OFF;
}
 
Example 13
Project: incubator-netbeans   File: ProjectsRootNodeInitializedSoonerTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.OFF;
}
 
Example 14
Project: incubator-netbeans   File: StartLog.java   View Source Code Vote up 4 votes
@Override
public Level getLevel() {
    return willLog() ? Level.FINEST : Level.OFF;
}
 
Example 15
Project: incubator-netbeans   File: OrderingTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.OFF;
}
 
Example 16
Project: Pogamut3   File: MapEnvelopeTask.java   View Source Code Vote up 4 votes
public Level getLogLevel() {
    return Level.OFF;
}
 
Example 17
Project: Pogamut3   File: BaseTest.java   View Source Code Vote up 4 votes
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();
}
 
Example 18
Project: OKEventBus   File: AndroidLogger.java   View Source Code Vote up 4 votes
@Override
public void log(Level level, String msg) {
    if (level != Level.OFF) {
        Log.println(mapLevel(level), tag, msg);
    }
}
 
Example 19
Project: openjdk-jdk10   File: DebugLogger.java   View Source Code Vote up 2 votes
/**
 * 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();
}
 
Example 20
Project: OpenJSharp   File: DebugLogger.java   View Source Code Vote up 2 votes
/**
 * 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();
}