All Packages Class Hierarchy This Package Previous Next Index
Class guinea.util.Logger
java.lang.Object
|
+----guinea.util.Logger
- public class Logger
- extends Object
A class that is used to save various messages of the GP system.
Different levels of 'severety' of the events are provided. A
different logging level is provided separately for log file in
console.
Variable Index
- ·
BRIEF
-
- ·
consoleLogLevel
-
- ·
DEBUG
-
- ·
defaultVerbosity
- Default verbosity level.
- ·
defFacilityName
-
- ·
ERROR
-
- ·
levelStrings
- Logging levels as strings.
- ·
logFileName
-
- ·
logFormat
-
- ·
LOGLEVEL_BRIEF
-
- ·
LOGLEVEL_DEBUG
-
- ·
LOGLEVEL_ERROR
-
- ·
LOGLEVEL_NORMAL
-
- ·
LOGLEVEL_SILENT
-
- ·
LOGLEVEL_VERBOSE
-
- ·
LOGLEVEL_VERYVERBOSE
-
- ·
logPattern
- Text formatting pattern for logging to a file.
- ·
logScreenFormat
-
- ·
logScreenPattern
- Text formatting pattern for logging to console.
- ·
logWriter
-
- ·
NORMAL
-
- ·
NOTICE
-
- ·
SILENT
-
- ·
VERBOSE
-
- ·
VERYVERBOSE
-
- ·
WARNING
-
Constructor Index
- ·
Logger()
-
Method Index
- ·
brief(String)
-
- ·
closeLog()
- Close log file.
- ·
debug(String)
-
- ·
finalize()
- Finalize logger object.
- ·
flog(String, int, Exception)
- Log an exception to log.
- ·
flog(String, int, String)
- Log message to log.
- ·
flush()
- Flush logging file.
- ·
getLevel()
-
- ·
getLevel(String)
-
- ·
isLogged(String, int)
-
- ·
log(String, int, Exception)
- Log message to log.
- ·
log(String, int, String)
- Log message to log.
- ·
logError(Exception)
- Log an exception to log.
- ·
logError(String)
- Log a message to log.
- ·
logError(String, Exception)
- Log an exception to log.
- ·
logError(String, String)
- Log a message to log.
- ·
main(String[])
-
- ·
normal(String)
-
- ·
setConsoleLogLevel(int)
-
- ·
setConsoleLogLevel(String)
-
- ·
setLogFile(String)
- Set file name of logging file and open it for writing.
- ·
setLogLevel(int)
-
- ·
setLogLevel(String)
-
- ·
setLogLevel(String, int)
-
- ·
setLogLevels(Properties)
-
- ·
setVerbosity(int)
-
- ·
setVerbosity(String)
-
- ·
silent(String)
-
- ·
stringToLevel(String)
-
- ·
verbose(String)
-
- ·
veryverbose(String)
-
- ·
warning(String)
-
Variables
·
levelStrings
protected static final String levelStrings[]
- Logging levels as strings.
·
ERROR
public static final int ERROR
·
LOGLEVEL_ERROR
public static final int LOGLEVEL_ERROR
·
SILENT
public static final int SILENT
·
LOGLEVEL_SILENT
public static final int LOGLEVEL_SILENT
·
WARNING
public static final int WARNING
·
BRIEF
public static final int BRIEF
·
LOGLEVEL_BRIEF
public static final int LOGLEVEL_BRIEF
·
NOTICE
public static final int NOTICE
·
NORMAL
public static final int NORMAL
·
LOGLEVEL_NORMAL
public static final int LOGLEVEL_NORMAL
·
VERBOSE
public static final int VERBOSE
·
LOGLEVEL_VERBOSE
public static final int LOGLEVEL_VERBOSE
·
VERYVERBOSE
public static final int VERYVERBOSE
·
LOGLEVEL_VERYVERBOSE
public static final int LOGLEVEL_VERYVERBOSE
·
DEBUG
public static final int DEBUG
·
LOGLEVEL_DEBUG
public static final int LOGLEVEL_DEBUG
·
logPattern
protected String logPattern
- Text formatting pattern for logging to a file. Parameter 0 is
the date, parameter 1 is the severity level as a number, and
parameter 2 is the 'facility' that send this report. The text
of the report is appended at the end of this header.
·
logScreenPattern
protected String logScreenPattern
- Text formatting pattern for logging to console. This is same
as the file log pattern but without the time and date. .
·
logFormat
protected MessageFormat logFormat
·
logScreenFormat
protected MessageFormat logScreenFormat
·
defaultVerbosity
protected int defaultVerbosity
- Default verbosity level. The default is
NORMAL.
·
defFacilityName
protected String defFacilityName
·
logFileName
protected String logFileName
·
logWriter
protected transient PrintWriter logWriter
·
consoleLogLevel
protected int consoleLogLevel
Constructors
·
Logger
public Logger()
Methods
·
setVerbosity
public void setVerbosity(int level)
·
setLogLevel
public void setLogLevel(int level)
·
setVerbosity
public void setVerbosity(String level)
·
setLogLevel
public void setLogLevel(String level)
·
setConsoleLogLevel
public void setConsoleLogLevel(String level)
·
setConsoleLogLevel
public void setConsoleLogLevel(int level)
·
setLogLevels
public void setLogLevels(Properties p)
·
setLogLevel
public void setLogLevel(String facility,
int level)
·
stringToLevel
protected int stringToLevel(String level)
·
getLevel
public int getLevel(String facility)
·
getLevel
public int getLevel()
·
isLogged
public boolean isLogged(String facility,
int level)
·
debug
public final boolean debug(String facility)
·
verbose
public final boolean verbose(String facility)
·
veryverbose
public final boolean veryverbose(String facility)
·
brief
public final boolean brief(String facility)
·
normal
public final boolean normal(String facility)
·
silent
public final boolean silent(String facility)
·
warning
public final boolean warning(String facility)
·
log
public boolean log(String facility,
int level,
String msg)
- Log message to log.
- Parameters:
- facility - Who sent (which module, etc.) sent this
message. If
null
, default facility is used.
- level - Logging level of this message (severity).
- msg - Message to save to log.
- Returns:
-
True
if this message was saved to log,
false
if not.
·
log
public boolean log(String facility,
int level,
Exception ex)
- Log message to log.
- Parameters:
- facility - Who sent (which module, etc.) sent this
message. If
null
, default facility is used.
- level - Logging level of this message (severity).
- ex - An exception to print to the log.
- Returns:
-
True
if this message was saved to log,
false
if not.
·
flog
public void flog(String facility,
int level,
String msg)
- Log message to log. This is a fast version that doesn't check
whether the message should be logged. This is usually used to
force logging a message or the need for logging was just
checked earlier in current block, for example. The log()
methods use this method after they have determined that this
message should be saved.
- Parameters:
- facility - Who sent (which module, etc.) sent this
message. If
null
, default facility is used.
- level - Logging level of this message (severity).
- msg - Message to save to log.
·
flog
public void flog(String facility,
int level,
Exception ex)
- Log an exception to log. This is a fast version that doesn't
check whether the message should be logged. This is usually
used to force logging a message or the need for logging was
just checked earlier in current block, for example. The log()
methods use this method after they have determined that this
message should be saved.
- Parameters:
- facility - Who sent (which module, etc.) sent this
message. If
null
, default facility is used.
- level - Logging level of this message (severity).
- ex - An exception to print to the log. The stack trace
of the exception is printed.
·
logError
public void logError(String facility,
Exception ex)
- Log an exception to log. This version does not check whether
the message should be logged (errors generally should be saved
anyway).
- Parameters:
- facility - Who sent (which module, etc.) sent this
message. If
null
, default facility is used.
- ex - An exception to print to the log. The stack trace
of the exception is printed.
·
logError
public void logError(String facility,
String msg)
- Log a message to log. This version does not check whether the
message should be logged (errors generally should be saved
anyway).
- Parameters:
- facility - Who sent (which module, etc.) sent this
message. If
null
, default facility is used.
- msg - Message to save to log.
·
logError
public void logError(String msg)
- Log a message to log. This version does not check whether the
message should be logged (errors generally should be saved
anyway). Default facility is used as the facility.
- Parameters:
- msg - Message to save to log.
·
logError
public void logError(Exception ex)
- Log an exception to log. This version does not check whether
the message should be logged (errors generally should be saved
anyway). Default facility is used as the facility.
- Parameters:
- ex - An exception to print to the log. The stack trace
of the exception is printed.
·
setLogFile
public synchronized void setLogFile(String name) throws IOException
- Set file name of logging file and open it for writing.
- Parameters:
- name - File name of logging file.
- Throws: IOException
- If an error happened opening log file.
·
closeLog
public synchronized void closeLog()
- Close log file. A message about file being closed is saved to
file and the file is flushed and closed.
·
flush
public synchronized void flush()
- Flush logging file.
·
finalize
protected void finalize() throws Throwable
- Finalize logger object. This closes the log if it is still
open.
- Throws: Throwable
- If an exception is thrown for some
reason. Generally, this should not happen.
- Overrides:
- finalize in class Object
- See Also:
- closeLog
·
main
public static void main(String args[]) throws Exception
All Packages Class Hierarchy This Package Previous Next Index