|
Oracle Internet Directory API Reference 11g Release 1 (11.1.1) E10664-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.ldap.util.Logger
public class Logger
A logger utility to log the error messages.
Field Summary | |
---|---|
static int |
ALL_TYPES Messages of all types. |
static int |
DEBUG Debug Message |
static int |
ERROR Error Message |
static int |
INFO Informational Message |
static int |
WARNING Warning Message |
Constructor Summary | |
---|---|
Logger(java.io.OutputStream outS, int severity) Constructs a Logger object which provide methods to the log message to the specified output stream. |
|
Logger(java.io.OutputStream outS, int severity, boolean xmlLog) Constructs a Logger object which provide methods to the log message to the specified output stream as XML content. |
|
Logger(java.lang.String fileName, int severity, boolean append) Constructs a Logger object which will provide the methods to log the messages to the specified file. |
|
Logger(java.lang.String fileName, int severity, boolean append, boolean xmlLog) Constructs a Logger object which provide methods to the log messages as XML content to the specified file. |
Method Summary | |
---|---|
void |
close() Closes the writer streams. |
void |
log(java.lang.Exception ex, int severity) Logs the Exception object to a file. |
void |
log(java.lang.Exception ex, int severity, boolean console) logs the Exception object both to a file and console, |
void |
log(java.lang.String message, int severity) Logs the given message to a file if logging of the specified message category is enabled. |
void |
log(java.lang.String message, int severity, boolean console) Logs the specified message if logging of the specified category is enabled and if writing to console is set to true then the message is also written to cosole. |
void |
setSeverity(int severity) Set the severity of the log messages that needs to be logged. |
void |
unsetSeverity(int severity) unsets the severity of the log messages. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INFO
public static final int WARNING
public static final int DEBUG
public static final int ERROR
public static final int ALL_TYPES
Constructor Detail |
---|
public Logger(java.lang.String fileName, int severity, boolean append) throws LogException
e.x code // log only ERROR and WARNING messages, rest will be ignored. Logger logger = new Logger("LogFile.log",Logger.ERROR | Logger.WARNING false); .... ... logger.log("Unable to establish a connection", Logger.ERROR); this will result in writing to the log file the above message as ERROR: [Timestamp] Unable to establish a connection
fileName
- name of the file to which log message needs to written.severity
- specifies the message category that needs to be logged.append
- if true, then data will be written to the end of the file.LogException
- if an I/O error occurs.public Logger(java.lang.String fileName, int severity, boolean append, boolean xmlLog) throws LogException
e.x code // log only ERROR and WARNING messages, rest will be ignored. Logger logger = new Logger("LogFile.xml", Logger.ERROR|Logger.WARNING, false, true); .... ... logger.log("Unable to establish a connection", Logger.ERROR); logger.close(); this will result in writing to the log file the above message. The contents of the file is as follows <Log Timestamp="21 May 2002 09:45:45:34"> <Error Timestamp="21 May 2002 09:45:45:34"> Unable to establish a connection </Error> <Info Timestamp="21 May 2002 09:45:50:04"> ... </Info> ...... <Warning> ...... </Warning> </Log>
fileName
- name of the file to which log message needs to written.severity
- specifies the message category that needs to be logged.append
- if true, then data will be written to the end of the file.LogException
- if an I/O error occurs.public Logger(java.io.OutputStream outS, int severity) throws LogException
outS
- the output stream to which the log message needs to written.severity
- specifies the message category that needs to be logged.LogException
- if an I/O error occurs.public Logger(java.io.OutputStream outS, int severity, boolean xmlLog) throws LogException
outS
- the output stream to which the log message needs to written.severity
- specifies the message category that needs to be logged.xmlLog
- if true log messages will be written as XML content.LogException
- if an I/O error occurs.Method Detail |
---|
public void setSeverity(int severity)
severity
- the message category that needs to be logged.public void unsetSeverity(int severity)
severity
- the message category that needs to be logged.public void log(java.lang.String message, int severity)
message
- to be loggedseverity
- of the message.public void log(java.lang.String message, int severity, boolean console)
message
- to be loggedseverity
- of the message.public void log(java.lang.Exception ex, int severity)
message
- to be loggedseverity
- of the message.public void log(java.lang.Exception ex, int severity, boolean console)
message
- to be loggedseverity
- of the message.public void close()
|
Oracle Internet Directory API Reference 11g Release 1 (11.1.1) E10664-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |