Logger Logp() Example
Log a message, specifying source class and method, with no arguments.
Loggerclass Logp() method example. This example shows you how to use Logp() method.This method Log a message, specifying source class and method, with no arguments.
Here is the code:-
/*
* @Program that Log a message, specifying source class and method
* Logp.java
* Author:-RoseIndia Team
* Date:-1-July-2008
*/
import java.util.logging.Level;
import java.util.logging.Logger;
public class Logp {
public static void main(String[] args) {
Logger logger = Logger.getLogger("girish.log");
Level level = Level.parse("WARNING");
String Source = "Roseindia .net";
String sourceMethod = "login";
String msg = "Welcome to roseindia.net";
//Log a message, specifying source class and method
logger.logp(level, Source, sourceMethod, msg);
}
} |
Output of the program:-
1 Jul, 2008 4:48:27 PM Roseindia .net login
WARNING: Welcome to roseindia.net |
|