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

The following examples show how to use java.util.logging.Logger#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
@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 2
Source Project: roboconf-platform   File: DockerUtils.java    License: 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 3
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 4
@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 5
Source Project: syslog-java-client   File: SyslogHandlerTest.java    License: 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 6
@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 7
@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
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 9
@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 Project: roboconf-platform   File: ProgramUtils.java    License: 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 11
Source Project: netbeans   File: EarlyHandlerTest.java    License: 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 12
@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 13
public void logDebug(Logger logger, String message) {

        if (isAndroidLog()) {
            logger.info(message);
        } else {
            logger.fine(message);
        }
    }
 
Example 14
Source Project: lancoder   File: Worker.java    License: 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 Project: netbeans   File: LogAndTimeOutTest.java    License: 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
@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 17
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}
 
Example 18
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}
 
Example 19
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}
 
Example 20
public void launch(CountDownLatch done) {
    Logger log = Logger.getLogger("app_test_logger");
    log.fine("Test app is launched");

    done.countDown();
}