Using java.util.logging
import java.util.logging.*;
Define a static variable in class of type import java.util.logging.Logger
final static Logger logger = Logger.getLogger(MyLoggingClass.class.getName());
Use logging as below
logger.log(Level.INFO,”getUserDetails | userID=”+userID);
The output will come like this on console
[3/11/08 13:58:41:531 SGT] 00000037 MyLoggingClas I getUserDetails | userID=webmaster
Note the name of class name is coming by itself because it was passed in getLogger() method. Different levels of logs like SEVER, FINER, INFO etc can be used depending upon the requirement.
-
Archives
- March 2008 (7)
- February 2008 (2)
-
Categories
-
RSS
Entries RSS
Comments RSS