|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.kaariboga.util.Log
Global handling of logging and error messages. This class is purely static. Don't create any instance of it. Just use it like: Log.write( Log.INFORMATION, "All is fine." ); This class supports the following log levels: ERROR, WARNING, SUCCESS, INFORMATION, DEBUG. On startup loglevel INFORMATION is active. Note, that all errors in this class are written to System.err. This prevents infinite loops.
Field Summary | |
protected static java.lang.String |
backupLogfile
Name of the logfile backup |
static int |
DEBUG
Used to write a debug message for extended information |
static int |
ERROR
Used to write an error message |
protected static java.text.SimpleDateFormat |
formatter
date format |
protected static boolean |
hasLogfile
Is there a logfile to write to? |
static int |
INFORMATION
Used to write a normal status message |
protected static java.lang.String |
lineSeparator
OS dependent line separator |
protected static java.lang.String |
logfile
Name of the logfile |
protected static int |
loglevel
Logging requests are fullfilled up to this loglevel. |
protected static long |
maxLogSize
maximum size of the logfile in bytes, standard is 100000 |
static int |
NONE
Loglevel, if no messages should be logged |
protected static boolean |
standardOut
should messages be written to standard output? |
static int |
SUCCESS
Used to write a success message. |
static int |
WARNING
Used to write an warning message |
Constructor Summary | |
Log()
|
Method Summary | |
protected static void |
checkFileLength()
Checks the length of the logfile. |
static void |
setLog(java.lang.String log,
java.lang.String back)
Creates a new Log object that uses logfile as output. |
static void |
setLoglevel(int level)
Sets the loglevel of this Log. |
static void |
setMaxLogSize(int size)
Sets the maximum size of the logfile. |
static void |
setStandardOutput(boolean flag)
Determines if Java standard output should be used. |
static void |
write(int status,
java.lang.String message)
Writes a logging message. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int NONE
public static final int ERROR
public static final int WARNING
public static final int SUCCESS
public static final int INFORMATION
public static final int DEBUG
protected static java.lang.String logfile
protected static java.lang.String backupLogfile
protected static long maxLogSize
protected static boolean hasLogfile
protected static boolean standardOut
protected static int loglevel
protected static java.lang.String lineSeparator
protected static java.text.SimpleDateFormat formatter
Constructor Detail |
public Log()
Method Detail |
public static void setLog(java.lang.String log, java.lang.String back)
log
- Name of the logfileback
- Name as which the logfile should be stored, when it extends maximum sizepublic static void setLoglevel(int level)
level
- Loglevel up to which the messages are logged.
May have the following values:
NONE if no messages should be displayed,
ERROR for error messages,
WARNING for wanrings that are not critical,
SUCCESS if an operation has been successfully finished,
INFORMATION for general information,
DEBUG for extended debug information.public static void write(int status, java.lang.String message)
status
- Status of the message.
May have the following values:
ERROR for error messages,
WARNING for wanrings that are not critical,
SUCCESS if an operation has been successfully finished,
INFORMATION for general information,
DEBUG for extended debug information.message
- Text of the message.public static void setMaxLogSize(int size)
size
- Maximum size of the logfile in KBpublic static void setStandardOutput(boolean flag)
flag
- True, if standard output should be usedprotected static void checkFileLength()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |