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

The following examples show how to use java.util.logging.Level#OFF . These examples are extracted from open source projects. 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 Project: TencentKona-8   File: Log.java    License: 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
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 3
Source Project: jdk8u60   File: Log.java    License: 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 4
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 5
Source Project: hottub   File: Log.java    License: 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 6
/**
 * 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
public Level threshold() {
    for (Level l : LEVELS ) {
        if (this.toString().endsWith(l.getName())) {
            return l;
        }
    }
    return Level.OFF;
}
 
Example 8
Source Project: netbeans   File: Log.java    License: 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 9
public Level threshold() {
    for (Level l : LEVELS ) {
        if (this.toString().endsWith(l.getName())) {
            return l;
        }
    }
    return Level.OFF;
}
 
Example 10
Source Project: tomee   File: MavenLogStreamFactory.java    License: 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 11
Source Project: netbeans   File: FolderObjTest.java    License: 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 Project: tomee   File: Log4j2Logger.java    License: 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 13
/**
 * 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 14
Source Project: gdx-gamesvcs   File: GpgsClient.java    License: 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 15
Source Project: netbeans   File: OrderingTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.OFF;
}
 
Example 16
Source Project: netbeans   File: StartLog.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Level getLevel() {
    return willLog() ? Level.FINEST : Level.OFF;
}
 
Example 17
Source Project: olat   File: StatusDescription.java    License: Apache License 2.0 4 votes vote down vote up
private StatusDescription() {
    theLevel = Level.OFF;
    shortDesc = null;
    longDesc = null;
}
 
Example 18
Source Project: hottub   File: DebugLogger.java    License: 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
/**
 * 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
/**
 * 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();
}