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

The following examples show how to use java.util.logging.Level#FINE . 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: JDK14LoggerAdapter.java    From HttpSessionReplacer with 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 2
Source File: LibrariesStorage.java    From netbeans with 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 3
Source File: SignalLoggerTests.java    From reactor-core with 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 4
Source File: NotLevelEqualsRule.java    From otroslogviewer with Apache License 2.0 6 votes vote down vote up
/**
 * 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 5
Source File: PLogger.java    From uavstack with 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 6
Source File: DocumentedStoreProvider.java    From sis with 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 File: PLogger.java    From uavstack with 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 File: LoggerWrapper.java    From ViaBackwards with 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 File: Initializer.java    From sis with 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
Source File: UpdateDisabledModuleTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 11
Source File: OSGiRepositoryTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override protected Level logLevel() {
    return Level.FINE;
}
 
Example 12
Source File: JdkESLogger.java    From Elasticsearch with 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 13
Source File: ModuleManagerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 14
Source File: SystemManager.java    From baratine with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 15
Source File: FolderInstanceTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 16
Source File: PropertiesProviderTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 17
Source File: LogAndTimeOutTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 18
Source File: IntegrationTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 19
Source File: ExternalDeleteOfModifiedBigFileTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}
 
Example 20
Source File: FolderInstanceListenersWithCookieTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Level logLevel() {
    return Level.FINE;
}