Java Code Examples for java.util.logging.Logger#fine()

The following examples show how to use java.util.logging.Logger#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: TestLogConfigurationDeadLockWithConf.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            int barcount = getBarCount();
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar"+barcount+".l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 2
Source File: TestLogConfigurationDeadLockWithConf.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            int barcount = getBarCount();
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar"+barcount+".l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 3
Source File: EarlyHandlerTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testEarlyPublish() throws Exception {
    EarlyHandler eh = Lookup.getDefault().lookup(EarlyHandler.class);
    Logger allLogger = Logger.getLogger("org.myapplication.ui.test_early"); // Copied Installer.UI_LOGGER_NAME, not to initialize Installer class.
    allLogger.setLevel(Level.ALL);
    allLogger.addHandler(eh);
    
    allLogger.fine("Test Message 1");
    allLogger.info("Test Message 2");
    allLogger.finest("Test Message 3");
    
    Installer installer = Installer.findObject(Installer.class, true);
    installer.restored();
    assertEquals("EarlyHandler turned off", Level.OFF, eh.getLevel());
    
    allLogger.finer("Test Message 4");
    
    List<LogRecord> logs = InstallerTest.getLogs();
    assertEquals("Number of messages logged: ", 4, logs.size());
    for (int i = 0; i < logs.size(); i++) {
        assertEquals("Test Message "+(i+1), logs.get(i).getMessage());
    }
}
 
Example 4
Source File: ProgramUtils.java    From roboconf-platform with Apache License 2.0 6 votes vote down vote up
/**
 * Executes a command on the VM and logs the output.
 * @param logger a logger (not null)
 * @param command a command to execute (not null, not empty)
 * @param workingDir the working directory for the command
 * @param environmentVars a map containing environment variables (can be null)
 * @param applicationName the roboconf application name (null if not specified)
 * @param scopedInstancePath the roboconf scoped instance path (null if not specified)
 * @throws IOException if a new process could not be created
 * @throws InterruptedException if the new process encountered a process
 */
public static int executeCommand(
		final Logger logger,
		final String[] command,
		final File workingDir,
		final Map<String,String> environmentVars,
		final String applicationName,
		final String scopedInstancePath)
throws IOException, InterruptedException {

	ExecutionResult result = executeCommandWithResult( logger, command, workingDir, environmentVars, applicationName, scopedInstancePath);
	if( ! Utils.isEmptyOrWhitespaces( result.getNormalOutput()))
		logger.fine( result.getNormalOutput());

	if( ! Utils.isEmptyOrWhitespaces( result.getErrorOutput()))
		logger.warning( result.getErrorOutput());

	return result.getExitValue();
}
 
Example 5
Source File: TestLogConfigurationDeadLockWithConf.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            int barcount = getBarCount();
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar"+barcount+".l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 6
Source File: TestIsLoggable.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void loglevel(Level l, Logger logger, String message) {
    LogTest test = LogTest.valueOf("LEV_"+l.getName());
    switch(test) {
        case LEV_SEVERE:
            logger.severe(message);
            break;
        case LEV_WARNING:
            logger.warning(message);
            break;
        case LEV_INFO:
            logger.info(message);
            break;
        case LEV_CONFIG:
            logger.config(message);
            break;
        case LEV_FINE:
            logger.fine(message);
            break;
        case LEV_FINER:
            logger.finer(message);
            break;
        case LEV_FINEST:
            logger.finest(message);
            break;
    }
}
 
Example 7
Source File: TestLogConfigurationDeadLockWithConf.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            int barcount = getBarCount();
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar"+barcount+".l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 8
Source File: SyslogHandlerTest.java    From syslog-java-client with MIT License 6 votes vote down vote up
@Test
public void test(){
    Logger logger = Logger.getLogger(getClass().getName());
    logger.setLevel(Level.FINEST);

    UdpSyslogMessageSender messageSender = new UdpSyslogMessageSender();
    SyslogHandler syslogHandler = new SyslogHandler(messageSender, Level.ALL, null);

    messageSender.setSyslogServerHostname("cloudbees1.papertrailapp.com");
    messageSender.setSyslogServerPort(18977);

    syslogHandler.setMessageHostname("mysecretkey");
    syslogHandler.setAppName("SyslogHandlerTest");
    logger.addHandler(syslogHandler);

    logger.fine("hello world 2");
}
 
Example 9
Source File: TestLogConfigurationDeadLockWithConf.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            int barcount = getBarCount();
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar"+barcount+".l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 10
Source File: TestIsLoggable.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void loglevel(Level l, Logger logger, String message) {
    LogTest test = LogTest.valueOf("LEV_"+l.getName());
    switch(test) {
        case LEV_SEVERE:
            logger.severe(message);
            break;
        case LEV_WARNING:
            logger.warning(message);
            break;
        case LEV_INFO:
            logger.info(message);
            break;
        case LEV_CONFIG:
            logger.config(message);
            break;
        case LEV_FINE:
            logger.fine(message);
            break;
        case LEV_FINER:
            logger.finer(message);
            break;
        case LEV_FINEST:
            logger.finest(message);
            break;
    }
}
 
Example 11
Source File: DockerUtils.java    From roboconf-platform with Apache License 2.0 6 votes vote down vote up
/**
 * Finds an image by ID or by tag.
 * @param name an image ID or a tag name (can be null)
 * @param dockerClient a Docker client (not null)
 * @return an image, or null if none matched
 */
public static Image findImageByIdOrByTag( String name, DockerClient dockerClient ) {

	Image image = null;
	if( ! Utils.isEmptyOrWhitespaces( name )) {
		Logger logger = Logger.getLogger( DockerUtils.class.getName());

		List<Image> images = dockerClient.listImagesCmd().exec();
		if(( image = DockerUtils.findImageById( name, images )) != null )
			logger.fine( "Found a Docker image with ID " + name );
		else if(( image = DockerUtils.findImageByTag( name, images )) != null )
			logger.fine( "Found a Docker image with tag " + name );
	}

	return image;
}
 
Example 12
Source File: TestLogConfigurationDeadLock.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    try {
        while (goOn) {
            Logger l;
            Logger foo = Logger.getLogger("foo");
            Logger bar = Logger.getLogger("foo.bar");
            for (int i=0; i < LCOUNT ; i++) {
                l = Logger.getLogger("foo.bar.l"+nextLogger.incrementAndGet());
                l.fine("I'm fine");
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
    } catch (InterruptedException | RuntimeException x ) {
        fail(x);
    }
}
 
Example 13
Source File: LogStub.java    From LPAd_SM-DPPlus_Connector with Apache License 2.0 5 votes vote down vote up
public void logDebug(Logger logger, String message) {

        if (isAndroidLog()) {
            logger.info(message);
        } else {
            logger.fine(message);
        }
    }
 
Example 14
Source File: Worker.java    From lancoder with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void taskCancelled(ClientTask task) {
	Logger logger = Logger.getLogger("lancoder");
	logger.fine(String.format("Cancelled %s.%n", task));

	task.getProgress().reset();
	notifyAndRemove(task);
}
 
Example 15
Source File: LogAndTimeOutTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testLoadFromSubdirTheSFS() throws Exception {
    Logger log = Logger.getLogger(T.class.getName());
    for (int i = 0; i < 100; i++) {
        log.fine("Adding " + i);
        Thread.sleep(100);
    }
}
 
Example 16
Source File: ClassLoaderLeakTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}
 
Example 17
Source File: ClassLoaderLeakTest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}
 
Example 18
Source File: NativeCallsJNAImpl.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Override
public void preBlow(String path, long maxSize, boolean preAllocate)
    throws IOException {
  final Logger logger = ClientSharedUtils.getLogger();
  if (logger != null && logger.isLoggable(Level.FINE)) {
    logger.fine("DEBUG preBlow called for path = " + path);
  }
  if (!preAllocate || !hasFallocate()) {
    super.preBlow(path, maxSize, preAllocate);
    if (logger != null && logger.isLoggable(Level.FINE)) {
      logger.fine("DEBUG preBlow super.preBlow 1 called for path = "
          + path);
    }
    return;
  }
  int fd = -1;
  boolean unknownError = false;
  try {
    fd = createFD(path, 00644);
    if (!isOnLocalFileSystem(path)) {
      super.preBlow(path, maxSize, preAllocate);
      if (logger != null && logger.isLoggable(Level.FINE)) {
        logger.fine("DEBUG preBlow super.preBlow 2 called as path = "
            + path + " not on local file system");
      }
      if (TEST_NO_FALLOC_DIRS != null) {
        TEST_NO_FALLOC_DIRS.add(path);
      }
      return;
    }
    fallocateFD(fd, 0L, maxSize);
    if (TEST_CHK_FALLOC_DIRS != null) {
      TEST_CHK_FALLOC_DIRS.add(path);
    }
    if (logger != null && logger.isLoggable(Level.FINE)) {
      logger.fine("DEBUG preBlow posix_fallocate called for path = " + path
          + " and ret = 0 maxsize = " + maxSize);
    }
  } catch (LastErrorException le) {
    if (logger != null && logger.isLoggable(Level.FINE)) {
      logger.fine("DEBUG preBlow posix_fallocate called for path = " + path
          + " and ret = " + le.getErrorCode() + " maxsize = " + maxSize);
    }
    // check for no space left on device
    if (le.getErrorCode() == ENOSPC) {
      unknownError = false;
      throw new IOException("Not enough space left on device");
    }
    else {
      unknownError = true;
    }
  } finally {
    if (fd >= 0) {
      try {
        close(fd);
      } catch (Exception e) {
        // ignore
      }
    }
    if (unknownError) {
      super.preBlow(path, maxSize, preAllocate);
      if (logger != null && logger.isLoggable(Level.FINE)) {
        logger.fine("DEBUG preBlow super.preBlow 3 called for path = "
            + path);
      }
    }
  }
}
 
Example 19
Source File: ClassLoaderLeakTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}
 
Example 20
Source File: ClassLoaderLeakTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}