News:

Build a stunning handcrafted website with IT Acumens

Main Menu

Logger Logp2() Example

Started by VelMurugan, Dec 05, 2008, 04:08 PM

Previous topic - Next topic

VelMurugan

Logger Logp2() Example

Log a message, specifying source class and method, with an array of object arguments.

Loggerclass Logp2() method example. This example shows you how to use Logp2() method.This method Log a message, specifying source class and method, with an array of object arguments.

Here is the code:-

/*
* @Program that Log a message, specifying source class and method, with an
    array of object arguments.
* Logp2.java
* Author:-RoseIndia Team
* Date:-1-July-2008
*/

import java.util.logging.Level;
import java.util.logging.Logger;

public class Logp2 {

    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[]={"r","o","h","i","n","i"};
       logger.logp(level, Source, sourceMethod, msg,s);
    }
}


Output of the program:-

1 Jul, 2008 4:56:09 PM Roseindia .net login
WARNING: Welcome to roseindia.net

Source : CodeDiary