inria.util
Class Logger

java.lang.Object
  |
  +--inria.util.Logger

public class Logger
extends java.lang.Object

This class provides a flexible log mechanism. Some of the log functions can be redirected to the application. The provided log functions include:


Field Summary
static boolean append
           
static boolean debug
           
protected static int errLogFileMaxSize
           
static boolean trace
           
protected static java.lang.String traceFile
           
 
Constructor Summary
Logger()
           
 
Method Summary
static void busy(int percent)
           
static void debug(java.lang.Object o, java.lang.String s)
          prints a message to stdout if the debug flag is true.
static void debug(java.lang.String s)
          prints a message to stdout if the debug flag is true.
static void dump(byte[] data, int offset, int len)
           
static void dump(java.lang.Object o, byte[] data, int offset, int len)
           
static void dump(java.io.PrintStream out, byte[] data, int offset, int len)
          unconditional dump.
static void error(java.lang.Object o, java.lang.String s)
          prints a trace message.
static void error(java.lang.Object o, java.lang.String s, java.lang.Exception e)
           
static void error(java.lang.String s)
           
static void error(java.lang.String s, java.lang.Exception e)
           
static void fatal(java.lang.Object o, java.lang.String s)
           
static void fatal(java.lang.String s)
           
static java.lang.String getTraceFile()
           
static void redirect(LoggerInterface c)
          redirects trace, error and status messages to the given interface.
static void setDebug(boolean f)
          turns on/off the debug mode.
static void setErrorLogFile(java.lang.String errLogFile)
          sets the errlog file.
static void setTrace(boolean f)
          turns on/off the trace mode.
static void setTraceFile(java.lang.String name)
          sets the trace file.
static java.lang.String shortClassname(java.lang.Object o)
           
static void stringDump(byte[] data, int offset, int len)
           
static void stringDump(java.io.PrintStream out, byte[] data, int offset, int len)
           
static void trace(java.lang.Object o, java.lang.String s)
          prints a message to stdout or the redirected logger if the trace flag is true.
static void trace(java.lang.String s)
          prints a message to stdout or the redirected logger if the trace flag is true.
static void warning(java.lang.Object o, java.lang.String s)
           
static void warning(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug

trace

public static boolean trace

append

public static boolean append

errLogFileMaxSize

protected static int errLogFileMaxSize

traceFile

protected static java.lang.String traceFile
Constructor Detail

Logger

public Logger()
Method Detail

redirect

public static void redirect(LoggerInterface c)
redirects trace, error and status messages to the given interface.
Parameters:
c - the console.

setDebug

public static void setDebug(boolean f)
turns on/off the debug mode.
Parameters:
f - the debug flag.

setTrace

public static void setTrace(boolean f)
turns on/off the trace mode.
Parameters:
f - the trace flag.

setErrorLogFile

public static void setErrorLogFile(java.lang.String errLogFile)
sets the errlog file. If the errlog file is given and logger is redirected, an error message will be printed on both.
Parameters:
errLogFile - the error log file name.

setTraceFile

public static void setTraceFile(java.lang.String name)
sets the trace file.
Parameters:
name - the trace file name.

getTraceFile

public static java.lang.String getTraceFile()

error

public static void error(java.lang.Object o,
                         java.lang.String s)
prints a trace message. If the error log file is set, this method always prints the message to this file.
Parameters:
o - the object from that the message is issued.
s - the message to print.

error

public static void error(java.lang.String s)

error

public static void error(java.lang.Object o,
                         java.lang.String s,
                         java.lang.Exception e)

error

public static void error(java.lang.String s,
                         java.lang.Exception e)

warning

public static void warning(java.lang.Object o,
                           java.lang.String s)

warning

public static void warning(java.lang.String s)

debug

public static void debug(java.lang.String s)
prints a message to stdout if the debug flag is true.
Parameters:
s - the message to print.

debug

public static void debug(java.lang.Object o,
                         java.lang.String s)
prints a message to stdout if the debug flag is true.
Parameters:
o - the object from that the message is issued.
s - the message to print.

trace

public static void trace(java.lang.String s)
prints a message to stdout or the redirected logger if the trace flag is true.
Parameters:
s - the message to print.

trace

public static void trace(java.lang.Object o,
                         java.lang.String s)
prints a message to stdout or the redirected logger if the trace flag is true.
Parameters:
o - the object from that the message is issued.
s - the message to print.

shortClassname

public static java.lang.String shortClassname(java.lang.Object o)

fatal

public static void fatal(java.lang.Object o,
                         java.lang.String s)

fatal

public static void fatal(java.lang.String s)

dump

public static void dump(java.lang.Object o,
                        byte[] data,
                        int offset,
                        int len)

dump

public static void dump(byte[] data,
                        int offset,
                        int len)

stringDump

public static void stringDump(byte[] data,
                              int offset,
                              int len)

dump

public static void dump(java.io.PrintStream out,
                        byte[] data,
                        int offset,
                        int len)
unconditional dump.

stringDump

public static void stringDump(java.io.PrintStream out,
                              byte[] data,
                              int offset,
                              int len)

busy

public static void busy(int percent)


JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.