|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.util.log.Logger
public class Logger
A singleton class that writes to a log file. This is designed as a simple logger, with none of the complexity of say, the new Java Logging API.
The two properties this class responds to are:
The constructor's filename parameter is optional. If it is not provided, a check
for a System property "ceryle.log.filename" will be made. Absent a provided value,
the default LOG_FILENAME ("application.log") will be used.
| Field Summary | |
|---|---|
static boolean |
autoflush
When true, flushes after each write. |
static String |
LOG_ACTIVE
Feature identifier: log active. |
static String |
LOG_APPEND
Feature identifier: log append. |
String |
LOG_CLOSE_CODE
Single character state code indicating a close log message. |
String |
LOG_ERROR_CODE
Single character state code indicating an error message. |
String |
LOG_FATAL_CODE
Single character state code indicating a fatal message. |
static String |
LOG_FEATURE_PFX
Logger Feature prefix. |
static String |
LOG_FILENAME
The default filename for the log file. |
String |
LOG_OK_CODE
Single character state code indicating a normal log message. |
String |
LOG_OPEN_CODE
Single character state code indicating an open log message. |
static String |
LOG_PROPERTY_FILENAME
Log filename property identifier. |
String |
LOG_UNKNOWN_CODE
Single character state code indicating an unknown state, or simply a log message. |
String |
LOG_WARNING_CODE
Single character state code indicating a warning message. |
static double |
logMaxSize
The size limit of the log file (in MB). |
static char |
RDELIM
The record delimiter character used (at beginning of line). |
| Method Summary | |
|---|---|
void |
close()
Closes the log file if open. |
void |
flush()
Flush the writer. |
static Properties |
getDefaultProperties()
Return the default properties for the Logger. |
static Logger |
getInstance(MessageHandler messagehandler,
String filename,
Properties properties)
As this is a singleton class, this returns the single instance of this class. |
double |
getLogFileLength()
Returns the length of the log file (in MB). |
String |
getLogFileName()
Returns the name of the log file (in MB). |
Writer |
getWriter()
Returns the writer. |
void |
open()
Opens log file for writing, defining the internal Writer. |
String |
write(String message)
Write the String message to the current log file if active, returning the message value. |
String |
write(String timestamp,
String message)
Write the String message to the current log file if active, returning the message value. |
String |
write(String state,
String timestamp,
String message)
Write the String message to the current log file if active, returning the message value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String LOG_PROPERTY_FILENAME
public static final String LOG_FEATURE_PFX
public static final String LOG_ACTIVE
public static final String LOG_APPEND
public static final String LOG_FILENAME
public static double logMaxSize
public static boolean autoflush
public final String LOG_UNKNOWN_CODE
public final String LOG_OPEN_CODE
public final String LOG_CLOSE_CODE
public final String LOG_OK_CODE
public final String LOG_WARNING_CODE
public final String LOG_ERROR_CODE
public final String LOG_FATAL_CODE
public static final char RDELIM
| Method Detail |
|---|
public static Properties getDefaultProperties()
public static Logger getInstance(MessageHandler messagehandler,
String filename,
Properties properties)
throws IOException
IOExceptionpublic String write(String message)
public String write(String timestamp,
String message)
public String write(String state,
String timestamp,
String message)
public void open()
throws IOException
IOExceptionpublic String getLogFileName()
public double getLogFileLength()
public Writer getWriter()
public void flush()
throws IOException
IOException
public void close()
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||