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

The following examples show how to use java.util.logging.Level#FINE . 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: uavstack   File: PLogger.java    License: Apache License 2.0 6 votes vote down vote up
private static String getLogLevelStr(Level level) {

        if (level == Level.INFO) {
            return "I ";
        }
        else if (level == Level.SEVERE) {
            return "E ";
        }
        else if (level == Level.WARNING) {
            return "W ";
        }
        else if (level == Level.FINEST) {
            return "D ";
        }
        else if (level == Level.FINE) {
            return "F ";
        }
        else if (level == Level.FINER) {
            return "FR";
        }
        else {
            return "I ";
        }
    }
 
Example 2
Source Project: HttpSessionReplacer   File: JDK14LoggerAdapter.java    License: MIT License 6 votes vote down vote up
private Level slf4jLevelIntToJULLevel(int slf4jLevelInt) {
    Level julLevel;
    switch (slf4jLevelInt) {
    case LocationAwareLogger.TRACE_INT:
        julLevel = Level.FINEST;
        break;
    case LocationAwareLogger.DEBUG_INT:
        julLevel = Level.FINE;
        break;
    case LocationAwareLogger.INFO_INT:
        julLevel = Level.INFO;
        break;
    case LocationAwareLogger.WARN_INT:
        julLevel = Level.WARNING;
        break;
    case LocationAwareLogger.ERROR_INT:
        julLevel = Level.SEVERE;
        break;
    default:
        throw new IllegalStateException("Level number " + slf4jLevelInt + " is not recognized.");
    }
    return julLevel;
}
 
Example 3
Source Project: netbeans   File: LibrariesStorage.java    License: Apache License 2.0 6 votes vote down vote up
private void logBrokenLibraryDescripor(
    @NonNull FileObject descriptorFile,
    @NonNull Exception cause){
    Level level = Level.WARNING;
    if (cause instanceof LibraryDeclarationHandlerImpl.UnknownLibraryTypeException) {
        if (((LibraryDeclarationHandlerImpl.UnknownLibraryTypeException) cause).type.equals("j2se")) {
            // possibly in a unit test, be quiet
            level = Level.FINE;
        } else {
            //log unknown library type as INFO common with FoD
            level = Level.INFO;
        }
    }
    LOG.log(
        level,
        "Cannot load library from file {0}, reason: {1}",   //NOI18N
        new Object[] {
            FileUtil.getFileDisplayName(descriptorFile),
            cause.getMessage()
       });
}
 
Example 4
Source Project: reactor-core   File: SignalLoggerTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void logErrorUsesDebugWhenFine() {
	Level level = Level.FINE;

	Mono<String> source = Mono.error(new IllegalStateException("ignored"));
	Logger mockLogger = Mockito.mock(Logger.class);
	when(mockLogger.isErrorEnabled()).thenReturn(true);
	when(mockLogger.isDebugEnabled()).thenReturn(true);
	when(mockLogger.isTraceEnabled()).thenReturn(true);

	SignalLogger<String> sl = new SignalLogger<>(source, null, level,
			false, s -> mockLogger);

	sl.onErrorCall().accept(new IllegalStateException("boom"));

	verify(mockLogger, never()).isErrorEnabled();
	verify(mockLogger, times(1)).isDebugEnabled();
	verify(mockLogger, never()).isTraceEnabled();
	verify(mockLogger, times(1)).debug(Mockito.anyString(), (Object[]) Mockito.any());
	verify(mockLogger, times(1)).debug(Mockito.anyString(), (Throwable) Mockito.any());
	verifyNoMoreInteractions(mockLogger);
}
 
Example 5
/**
 * Deserialize the state of the object.
 *
 * @param in object input stream.
 * @throws IOException if error in reading stream for deserialization.
 */
private void readObject(final java.io.ObjectInputStream in) throws IOException {
  populateLevels();
  int levelInt = in.readInt();
  if (Level.INFO.intValue() == levelInt) {
    level = Level.INFO;
  } else if (Level.CONFIG.intValue() == levelInt) {
    level = Level.CONFIG;
  } else if (Level.FINE.intValue() == levelInt) {
    level = Level.FINE;
  } else if (Level.FINER.intValue() == levelInt) {
    level = Level.FINER;
  } else if (Level.FINEST.intValue() == levelInt) {
    level = Level.FINEST;
  } else if (Level.SEVERE.intValue() == levelInt) {
    level = Level.SEVERE;
  } else if (Level.WARNING.intValue() == levelInt) {
    level = Level.WARNING;
  } else {
    level = Level.FINEST;
  }
}
 
Example 6
Source Project: sis   File: DocumentedStoreProvider.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns a more complete description of the format, sending warnings to the given listeners if non-null.
 *
 * @param  listeners  where to report the warning in case of error, or {@code null} if none.
 * @return a description of the data format.
 */
public final Format getFormat(final StoreListeners listeners) {
    /*
     * Note: this method does not cache the format because such caching is already done by MetadataSource.
     */
    if (name != null) try {
        return MetadataSource.getProvided().lookup(Format.class, name);
    } catch (MetadataStoreException e) {
        if (listeners != null) {
            listeners.warning(e);
        } else {
            final Level level;
            if (!logged) {
                logged = true;      // Not atomic - not a big deal if we use warning level twice.
                level = Level.WARNING;
            } else {
                level = Level.FINE;
            }
            final LogRecord record = Resources.forLocale(null).getLogRecord(level,
                    Resources.Keys.CanNotGetCommonMetadata_2, getShortName(), e.getLocalizedMessage());
            record.setLoggerName(Modules.STORAGE);
            Logging.log(getClass(), "getFormat", record);
        }
    }
    return super.getFormat();
}
 
Example 7
Source Project: uavstack   File: PLogger.java    License: Apache License 2.0 5 votes vote down vote up
private static Level getLevel(LogLevel level) {

        Level l = Level.INFO;
        switch (level) {
            case ALL:
                l = Level.ALL;
                break;
            case DEBUG:
                l = Level.FINEST;
                break;
            case ERR:
                l = Level.SEVERE;
                break;
            case FINE:
                l = Level.FINE;
                break;
            case FINER:
                l = Level.FINER;
                break;
            case INFO:
                l = Level.INFO;
                break;
            case WARNING:
                l = Level.WARNING;
                break;
            default:
                l = Level.INFO;
                break;
        }
        return l;
    }
 
Example 8
Source Project: ViaBackwards   File: LoggerWrapper.java    License: MIT License 5 votes vote down vote up
public void log(Level level, String msg, Throwable params) {
    if (level == Level.FINE) {
        this.base.debug(msg, params);
    } else if (level == Level.WARNING) {
        this.base.warn(msg, params);
    } else if (level == Level.SEVERE) {
        this.base.error(msg, params);
    } else if (level == Level.INFO) {
        this.base.info(msg, params);
    } else {
        this.base.trace(msg, params);
    }

}
 
Example 9
Source Project: sis   File: Initializer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Prepares a log record saying that a connection to the spatial metadata database has been created.
 * This method can be invoked after {@link DataSource#getConnection()}. When invoked for the first time,
 * the record level is set to {@link Level#CONFIG}. On next calls, the level become {@link Level#FINE}.
 *
 * @param  metadata  the value of {@code DataSource.getConnection().getMetaData()} or equivalent.
 * @return the record to log. Caller should set the source class name and source method name.
 * @throws SQLException if an error occurred while fetching the database URL.
 *
 * @since 0.8
 */
public static LogRecord connected(final DatabaseMetaData metadata) throws SQLException {
    final Level level;
    synchronized (Initializer.class) {
        level = connected ? Level.FINE : Level.CONFIG;
        connected = true;
    }
    final LogRecord record = Messages.getResources(null).getLogRecord(level,
            Messages.Keys.ConnectedToGeospatialDatabase_1, SQLUtilities.getSimplifiedURL(metadata));
    record.setLoggerName(Loggers.SYSTEM);
    return record;
}
 
Example 10
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 11
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 12
Source Project: netbeans   File: IntegrationTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 13
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 14
Source Project: netbeans   File: LogAndTimeOutTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 15
Source Project: netbeans   File: PropertiesProviderTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 16
Source Project: netbeans   File: FolderInstanceTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 17
/**
 * Creates a new servlet server.
 */
public SystemManager(String id, ClassLoader parentLoader)
{
  if (id == null) {
    id = "default";
  }

  _id = id;

  if (parentLoader == null) {
    parentLoader = Thread.currentThread().getContextClassLoader();
  }

  final ClassLoader finalParentLoader = parentLoader;

  initLog.log(Level.FINE,
              () -> L.l("new SystemManager(${0}/${1})", finalParentLoader, _id));

  EnvLoader.addCloseListener(this, parentLoader);

  /*
  if (parentLoader instanceof EnvironmentClassLoader) {
    _classLoader = (EnvironmentClassLoader) parentLoader;
  }
  else {
    // the environment id must be independent of the server because
    // of cluster cache requirements.
    _classLoader = EnvironmentClassLoader.create(parentLoader, "system:");
  }
  */
  _classLoader = EnvironmentClassLoader.create(parentLoader, "system:");
  
  _systemLocal.set(this, _classLoader);

  _globalSystemRef = new WeakReference<>(this);

  _lifecycle = new Lifecycle(log, toString(), Level.FINE);

  // lifecycle for the classloader binding (cdi beans)
  addSystem(new ClassLoaderSystemBind());
  // lifecycle for the classloader itself
  addSystem(new ClassLoaderSystemStart());

  Thread thread = Thread.currentThread();
  ClassLoader oldLoader = thread.getContextClassLoader();

  try {
    thread.setContextClassLoader(_classLoader);

    EnvLoader.init();
    
    // JmxUtil.addContextProperty("Server", getId());
  } finally {
    thread.setContextClassLoader(oldLoader);
  }
}
 
Example 18
Source Project: netbeans   File: ModuleManagerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 19
Source Project: Elasticsearch   File: JdkESLogger.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected void internalDebug(String msg, Throwable cause) {
    LogRecord record = new ESLogRecord(Level.FINE, msg);
    record.setThrown(cause);
    logger.log(record);
}
 
Example 20
Source Project: netbeans   File: OSGiRepositoryTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override protected Level logLevel() {
    return Level.FINE;
}