Logger Logp1() Example
Log a message, specifying source class and method, with a single object parameter to the log message.
Loggerclass Logp1() method example. This example shows you how to use Logp1() method.This method Log a message, specifying source class and method, with a single object parameter to the log message.
Here is the code:-
/*
* @Program that Log a message, specifying source class and method, with a
single object parameter to the log message.
* Logp1.java
* Author:-RoseIndia Team
* Date:-1-July-2008
*/
import java.util.logging.Level;
import java.util.logging.Logger;
public class Logp1 {
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";
String s=new String("jdfk");
logger.logp(level, Source, sourceMethod, msg,s);
}
} |
Output of the program:-
1 Jul, 2008 4:52:11 PM Roseindia .net login
WARNING: Welcome to roseindia.net |
|