Methods Summary |
---|
public static synchronized com.sun.enterprise.cli.framework.CLILogger | getInstance()returns the instance of the logger
if (logger == null)
{
logger = new CLILogger();
}
return logger;
|
public java.util.logging.Level | getOutputLevel()returns the current output Level
return s1asLogger.getLevel();
|
public static boolean | isDebug()
if (System.getProperty(DEBUG_FLAG) != null) {
return true;
} else {
return false;
}
|
public static void | main(java.lang.String[] args)
CLILogger logger = new CLILogger();
try
{
String sLevel = null;
// LocalStringsManager lsm = LocalStringsManagerFactory.getLocalStringsManager("com.sun.enterprise.cli.framework", "LocalStrings" );
LocalStringsManager lsm = LocalStringsManagerFactory.getFrameworkLocalStringsManager();
InputsAndOutputs.getInstance().getUserOutput().print(lsm.getString("PROMPT"));
sLevel = InputsAndOutputs.getInstance().getUserInput().getLine();
logger.setOutputLevel(java.util.logging.Level.parse(sLevel));
System.out.println("Logger level = " + logger.getOutputLevel());
logger.printDetailMessage("Fine");
logger.printMessage("Info");
logger.printError("Error");
logger.printWarning("Warning");
logger.printDebugMessage("Debug");
// test from file
InputsAndOutputs.getInstance().setUserOutputFile("UserOutput.txt");
InputsAndOutputs.getInstance().setErrorOutputFile("ErrorOutput.txt");
InputsAndOutputs.getInstance().setUserInputFile("test_input.txt");
InputsAndOutputs.getInstance().getUserOutput().print(lsm.getString("PROMPT"));
sLevel = InputsAndOutputs.getInstance().getUserInput().getLine();
logger.setOutputLevel(java.util.logging.Level.parse(sLevel));
logger.printDetailMessage("Fine");
logger.printMessage("Info");
logger.printError("Error");
logger.printWarning("Warning");
logger.printDebugMessage("Debug");
}
catch (Exception e)
{
logger.printExceptionStackTrace(e);
//e.printStackTrace();
}
|
public void | printDebugMessage(java.lang.String message)prints the message with level as FINEST
s1asLogger.log(Level.FINEST, message);
|
public void | printDetailMessage(java.lang.String message)prints the message with level as FINE
s1asLogger.log(Level.FINE, message);
|
public void | printError(java.lang.String message)prints the message with level as SEVERE
s1asLogger.log(Level.SEVERE, message);
|
public void | printExceptionStackTrace(java.lang.Throwable e)prints the exception message with level as FINEST
/*
java.lang.StackTraceElement[] ste = e.getStackTrace();
for (int ii=0; ii<ste.length; ii++)
{
printDebugMessage(ste[ii].toString());
}
*/
final ByteArrayOutputStream output = new ByteArrayOutputStream( kDefaultBufferSize );
e.printStackTrace( new java.io.PrintStream(output));
printDebugMessage(output.toString());
|
public void | printMessage(java.lang.String message)prints the message with level as INFO
s1asLogger.log(Level.INFO, message);
|
public void | printWarning(java.lang.String message)prints the message with level as WARNING
s1asLogger.log(Level.WARNING, message);
|
public void | setOutputLevel(java.util.logging.Level level)Sets the output Level
if (System.getProperty(DEBUG_FLAG) == null)
s1asLogger.setLevel(level);
|