Logger Fine1() Example
Log a FINE message.
Loggerclass Fine1() method example. This example shows you how to use Fine1() method.This method Log a FINE message.
Here is the code:-
/*
* @Program that Log a FINE message.
* Fine1.java
* Author:-RoseIndia Team
* Date:-1-July-2008
*/
import java.io.IOException;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Logger;
public class Fine1 {
public static void main(String args[]) {
//created logger
Logger logger = Logger.getLogger("com.example");
Logger logger1 = Logger.getLogger("com.example.words");
//declaring handler
Handler handler = null;
try {
//creating a handler
handler = new FileHandler("Rose.log");
} catch (IOException e) {
System.out.println("File not created");
handler = new ConsoleHandler();
}
//Adding a log Handler to receive logging messages.
logger.addHandler(handler);
//Log an INFO message.
logger.info("INFO Message");
//Log a FINE message.
logger.fine("fine");
}
} |
Output of the program:-
2 Jul, 2008 4:56:28 PM Fine1 main
INFO: INFO Message |
|