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

The following examples show how to use java.util.logging.Level#OFF . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Log.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 2
Source File: Log.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 3
Source File: LoggerSettingManager.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
synchronized public LoggerSetting createLoggerSetting ( Logger logger, String directoryName,
		String fileName, Level logLevel, int rollingSize, int maxBackupIndex )
{
	String logFileName = null;
	LogHandler logHandler = null;
	LoggerSetting setting;
	
	if ( directoryName != null || fileName != null  )
	{			
		logFileName = generateUniqueLogFileName( directoryName, fileName );
	}
	
	if ( logFileName != null && logLevel != Level.OFF)
		logHandler = getLogHandler(logFileName, rollingSize, maxBackupIndex, logLevel);
	
	setting = new LoggerSetting( logger, logFileName, 
			logHandler == null ? null : logHandler.getHandler( ), logLevel, rollingSize, maxBackupIndex);
	
	settingList.add( setting );
	
	return setting;
}
 
Example 4
Source File: Log.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: LoggerF.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
private Level getLevel( String level ){
	if ( level.equalsIgnoreCase("info") )
		return Level.INFO;
	else if ( level.equalsIgnoreCase("all") )
		return Level.ALL;
	else if ( level.equalsIgnoreCase("config") )
		return Level.CONFIG;
	else if ( level.equalsIgnoreCase("fine") )
		return Level.FINE;
	else if ( level.equalsIgnoreCase("finer") )
		return Level.FINER;
	else if ( level.equalsIgnoreCase("off") )
		return Level.OFF;
	else if ( level.equalsIgnoreCase("severe") )
		return Level.SEVERE;
	else if ( level.equalsIgnoreCase("warning") )
		return Level.WARNING;
	else
		return Level.INFO;
}
 
Example 6
Source File: Log.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 7
Source File: MavenLogStreamFactory.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public Level getLevel() {
    if (logger.isDebugEnabled()) {
        return Level.FINER;
    } else if (logger.isInfoEnabled()) {
        return Level.INFO;
    } else if (logger.isWarnEnabled()) {
        return Level.WARNING;
    } else if (logger.isErrorEnabled()) {
        return Level.SEVERE;
    }
    return Level.OFF;
}
 
Example 8
Source File: GpgsClient.java    From gdx-gamesvcs with Apache License 2.0 5 votes vote down vote up
/**
 * 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 9
Source File: App.java    From vicinity-gateway-api with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Translates the string value of logging level configuration parameter to
 * {@link java.util.logging.Level Level} object, that can be fed to
 * {@link java.util.logging.logger Logger}. If the stringValue is null, it will
 * return the default logging level set by {@link #CONFIG_DEF_LOGGINGLEVEL
 * CONFIG_DEF_LOGGINGLEVEL} constant. If the string contains other unexpected
 * value (worst case) returns {@link java.util.logging.level#INFO INFO}.
 * 
 * @param stringValue String value of the configuration parameter.
 * @return String translated into {@link java.util.logging.level Level} object.
 */
private static Level translateLoggingLevel(String stringValue) {

	if (stringValue == null) {
		stringValue = CONFIG_DEF_LOGGINGLEVEL;
	}

	switch (stringValue) {

		case "OFF":
			return Level.OFF;

		case "SEVERE":
			return Level.SEVERE;

		case "WARNING":
			return Level.WARNING;

		case "INFO":
			return Level.INFO;

		case "CONFIG":
			return Level.CONFIG;

		case "FINE":
			return Level.FINE;

		case "FINER":
			return Level.FINER;

		case "FINEST":
			return Level.FINEST;

		default:
			return Level.INFO;
	}
}
 
Example 10
Source File: Log4j2Logger.java    From tomee with Apache License 2.0 5 votes vote down vote up
private Level fromL4J(final org.apache.logging.log4j.Level l) {
    Level l2 = null;
    switch (l.getStandardLevel()) {
        case ALL:
            l2 = Level.ALL;
            break;
        case FATAL:
            l2 = Level.SEVERE;
            break;
        case ERROR:
            l2 = Level.SEVERE;
            break;
        case WARN:
            l2 = Level.WARNING;
            break;
        case INFO:
            l2 = Level.INFO;
            break;
        case DEBUG:
            l2 = Level.FINE;
            break;
        case OFF:
            l2 = Level.OFF;
            break;
        case TRACE:
            l2 = Level.FINEST;
            break;
        default:
            l2 = Level.FINE;
    }
    return l2;
}
 
Example 11
Source File: FolderObjTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Level logLevel() {
    String[] testsWithEnabledLogger = new String[] {
        "testCreateFolder72617",
        "testCreateData72617",
        ".testBug127256"
    };
    return (Arrays.asList(testsWithEnabledLogger).contains(getName())) ? 
        Level.FINEST : Level.OFF;
}
 
Example 12
Source File: TestIsLoggable.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Level threshold() {
    for (Level l : LEVELS ) {
        if (this.toString().endsWith(l.getName())) {
            return l;
        }
    }
    return Level.OFF;
}
 
Example 13
Source File: Log.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void close() {
    Logger l = this.logger;
    if (getLevel() != Level.OFF && l != null) {
        l.addHandler(this);
    }
}
 
Example 14
Source File: TestIsLoggable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Level threshold() {
    for (Level l : LEVELS ) {
        if (this.toString().endsWith(l.getName())) {
            return l;
        }
    }
    return Level.OFF;
}
 
Example 15
Source File: StartLog.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Level getLevel() {
    return willLog() ? Level.FINEST : Level.OFF;
}
 
Example 16
Source File: StatusDescription.java    From olat with Apache License 2.0 4 votes vote down vote up
private StatusDescription() {
    theLevel = Level.OFF;
    shortDesc = null;
    longDesc = null;
}
 
Example 17
Source File: OrderingTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.OFF;
}
 
Example 18
Source File: DebugLogger.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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 19
Source File: Log.java    From GreasySpoon with GNU Affero General Public License v3.0 2 votes vote down vote up
/**
 * Store a message in ACCESS log.<br>
 * All accesses should be logged (so no Level is asked) 
 * @param message Message content
 */
public final static synchronized void access(String message) {
	if (!accessEnabled || loglevel == Level.OFF ) return;
	logger.store(ACCESS, null, new StringBuilder(message));
}
 
Example 20
Source File: DebugLogger.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}