JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.util
Class Log

java.lang.Object
  |
  +--org.objectweb.jac.util.Log

public final class Log
extends Object

The Log class provides a means to send some informational, debugging or error messages like System.out.println but traces can be enabled or disabled at runtime.

JAC supports a -V launching option that allows the user to enable a given trace category (for instance, by using -V jac, the user can see what happens in the JAC core system.

Author:
Laurent Martelli

Constructor Summary
Log()
           
 
Method Summary
static String dump()
           
static void error(String message)
          Traces an error into the System.err stream.
static Set getCategories(Object substance)
           
static Map getLevels()
          Returns a Map category -> enabled saying which traces are enables
static void setFileName(String name, String header)
          Sets the logging file.
static void setLevel(String category, int level)
          Sets the verbose level of a given category.
static void stack(String category)
           
static void stack(String category, int level)
          Print the stack trace of an exception with a level lower than levels[category] are discarded.
static void trace(String category, int level, String message)
          Traces with a level lower than levels[category] are discarded.
static void trace(String category, int level, Throwable exception)
          Print the stack trace of an exception with a level lower than levels[category] are discarded.
static void trace(String category, String message)
          Traces with a level equals to 1.
static void trace(String category, Throwable exception)
          Print a stack trace with a level equals to 1.
static void warning(String message)
          Traces a warning into the System.err stream.
static void warning(String message, int level)
          Traces a warning into the System.err stream.
static void warning(String category, int level, String message)
          Traces a warning into the System.err stream only if the given category is enable to trace.
static void warning(String category, String message)
          Traces a warning into the System.err stream only if the given category is enable to trace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log

public Log()
Method Detail

setFileName

public static void setFileName(String name,
                               String header)
Sets the logging file.

Parameters:
name - the file name if null=>log to the standard output
header - a string to prepend to each line logged.

trace

public static void trace(String category,
                         int level,
                         String message)
Traces with a level lower than levels[category] are discarded.

Parameters:
category - a string representing the category to trace
level - the level of the trace (1 is always printed)
message - the message to print out

trace

public static void trace(String category,
                         int level,
                         Throwable exception)
Print the stack trace of an exception with a level lower than levels[category] are discarded.

Parameters:
category - a string representing the category to trace
level - the level of the trace (1 is always printed)
exception - the exception

stack

public static void stack(String category,
                         int level)
Print the stack trace of an exception with a level lower than levels[category] are discarded.

Parameters:
category - a string representing the category to trace
level - the level of the trace (1 is always printed)

stack

public static void stack(String category)

trace

public static void trace(String category,
                         String message)
Traces with a level equals to 1.

Parameters:
category - a string representing the category to trace
message - the message to print out
See Also:
trace(String,int,String)

trace

public static void trace(String category,
                         Throwable exception)
Print a stack trace with a level equals to 1.

Parameters:
category - a string representing the category to trace
exception - the message to print out
See Also:
trace(String,int,String)

error

public static void error(String message)
Traces an error into the System.err stream.

Parameters:
message - the error message to print out

warning

public static void warning(String message,
                           int level)
Traces a warning into the System.err stream.

Parameters:
message - the warning message to print out
level - warning level (0=important, 1=normal, 2=low, ...)

warning

public static void warning(String message)
Traces a warning into the System.err stream.

Parameters:
message - the warning message to print out

warning

public static void warning(String category,
                           String message)
Traces a warning into the System.err stream only if the given category is enable to trace.

Parameters:
message - the warning message to print out

warning

public static void warning(String category,
                           int level,
                           String message)
Traces a warning into the System.err stream only if the given category is enable to trace.

Parameters:
message - the warning message to print out

setLevel

public static void setLevel(String category,
                            int level)
Sets the verbose level of a given category.

The higher, the more traces are printed out.

Parameters:
category - the category to set the level of
level - the category verbose level

getLevels

public static Map getLevels()
Returns a Map category -> enabled saying which traces are enables


getCategories

public static Set getCategories(Object substance)

dump

public static String dump()

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli