Logger Logp3() Example
Log a message, specifying source class and method, with associated Throwable information.
Loggerclass Logp3() method example. This example shows you how to use Logp3() method.This method Log a message, specifying source class and method, with associated Throwable information.
Here is the code:-
/*
* @Program that Log a message, specifying source class and method, with
associated Throwable information.
* Logp3.java
* Author:-RoseIndia Team
* Date:-1-July-2008
*/
import java.util.logging.Level;
import java.util.logging.Logger;
public class Logp3 {
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";
Throwable throwable=new Throwable("File not found");
logger.logp(level, Source, sourceMethod, msg,throwable);
}
} |
Output of the program:-
1 Jul, 2008 4:59:49 PM Roseindia .net login
WARNING: Welcome to roseindia.net
java.lang.Throwable: File not found |
|