|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.bb.common.components.Log
Log is an utility class that allows an application to print logs and errors either to the standard out or to output file
Field Summary | |
static int |
DEBUG
|
static int |
ERROR
|
static int |
FATAL
Log levels: A 'INFORMATIONAL'(default) indicates that all output log statements are put out A 'WARNING' indicates that only statements of the loglevel 'WARNING' or lower are to be printed A 'ERROR' indicates that only statements of the loglevel 'ERROR' or lower are to be printed A 'FATAL' indicates that only statements indicating fatal errors are to be printed |
static int |
INFORMATIONAL
|
private static boolean |
m_bLog
Boolean flag that allows logging to be turned on or off |
private static int |
m_level
the log level |
private static String[] |
m_levelText
|
private static PrintStream |
m_printStreamOut
The actual print stream - is set to standard out by default but can be set to point to a file |
static int |
SPILLGUTS
|
static int |
WARNING
|
Constructor Summary | |
private |
Log()
Disallow instantiating this class |
Method Summary | |
static void |
disable()
Sets the logging off |
static void |
enable()
Sets the logging on |
static void |
print(int level,
Exception e)
Prints the exeception to the log, including the stack trace from the exception. |
static void |
print(int level,
Object obj)
Print to stdout or to the output file |
static void |
print(int level,
String outline)
Print to stdout or to the output file |
static void |
setLevel(int level)
Sets log level |
static void |
setOut(PrintStream output)
Sets the printstream passed as the output stream |
static void |
setOut(String fileName)
Sets the output stream so as to send output to the filename |
private static String |
showLevel(int lvl)
Returns the levels textual level! |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int FATAL
Log levels: A 'INFORMATIONAL'(default) indicates that all output log statements are put out A 'WARNING' indicates that only statements of the loglevel 'WARNING' or lower are to be printed A 'ERROR' indicates that only statements of the loglevel 'ERROR' or lower are to be printed A 'FATAL' indicates that only statements indicating fatal errors are to be printed
public static final int ERROR
public static final int WARNING
public static final int INFORMATIONAL
public static final int DEBUG
public static final int SPILLGUTS
private static final String[] m_levelText
private static int m_level
private static boolean m_bLog
private static PrintStream m_printStreamOut
Constructor Detail |
private Log() throws UnsupportedOperationException
Method Detail |
private static String showLevel(int lvl)
Returns the levels textual level!
public static void setOut(String fileName) throws IOException
fileName
- name of the file to which output is to
be redirectedpublic static void setOut(PrintStream output)
output
- print stream to be set as output streampublic static void enable()
public static void disable()
public static void setLevel(int level)
level
- level to set the logging toIOException
- thrown if level is not recognizedpublic static void print(int level, String outline)
outline
- String to be printed outpublic static void print(int level, Exception e)
Prints the exeception to the log, including the stack trace from the exception.
level
- The log level of the exception.e
- The exception and its stack trace to log.public static void print(int level, Object obj)
obj
- Object to be printed out
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |