Package com.portal.pcm
Class DefaultLog
java.lang.Object
com.portal.pcm.DefaultLog
The
DefaultLog class is a convenience class for debug and error
logging using the default log javapcm.log.
The JavaPCM library logs messages to this log, but the log can also be used by client
applications. Use the DefualtLog.log methods to write to this log.
DefaultLog uses "flag" style log control.
With flag style control, each message is tagged with a flag that specifies the
error message type. Possible flag values are defined in ErrorLog. Which
messages are logged is based on the log level set in the configuration file.
Configure the Infranet.properties file to set the levels and enable
logging. The entries are:
- infranet.log.file: The file path (the default is javapcm.log).
- infranet.log.level: Specifies which flags will result in a log entry.
0for none (default).1for ERROR messages2for ERROR and WARNING messages3for ERROR, WARNING, and DEBUG messages
- infranet.log.logallebuf:
trueto log all EBufExceptions (the default is false)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoLog(int control) Evaluates the control level to determine whether a log call will result in a log entry.static InputStreamgetLog()Retrieves theDefaultLogas anInputStream.static booleanDetermines if the message logged is stored in memory rather than on disk.static voidLogs information to the default log file.static voidLogs information to the default log file.static voidLogs a message to the log file along with a hex dump of the array of bytes.static voidLogs information to the default log file.static voidLogs the error message retrieved from theThrowableobject thrown by an error.static voidLogs information to the default log file.static voidLogs a message to the default log file.static voidsetFlags(int flags) Sets theDefaultLogmessage flag.static voidSets the application name.static voidSets theDefaultLogfile path name.static voidSet alternative log writer.
-
Constructor Details
-
DefaultLog
public DefaultLog()
-
-
Method Details
-
setName
Sets the application name.- Parameters:
name- The name of the application doing the logging.
-
setPath
Sets theDefaultLogfile path name.- Parameters:
path- The new log path.
-
setWriter
Set alternative log writer.- Parameters:
writer- NewWriterto write logs
-
setFlags
public static void setFlags(int flags) Sets theDefaultLogmessage flag.- Parameters:
flags- The message type.
-
log
Logs a message to the default log file.- Parameters:
message- The message to log.
-
log
Logs information to the default log file.- Parameters:
src- The location of the error. For example, a file name and a line number. Ifsrcis a string, it is used to describe the source. Otherwise, the name of the object class is used.message- The message to log.
-
log
Logs information to the default log file.- Parameters:
flags- TheDefaultLogmessage type.message- The message to log.
-
log
Logs the error message retrieved from theThrowableobject thrown by an error.- Parameters:
src- The location of the error. For example, a file name and a line number. Ifsrcis a string, it is used to describe the source. Otherwise, the name of the object class is used.flags- TheDefaultLogmessage type.thrown- the thrown error or exception to log.
-
log
Logs a message to the log file along with a hex dump of the array of bytes.- Parameters:
src- The location of the error. For example, a file name and a line number. Ifsrcis a string, it is used to describe the source. Otherwise, the name of the object class is used.flags- TheDefaultLogmessage type.message- The message to log.buf- The array of bytes to append to the message.
-
log
Logs information to the default log file.- Parameters:
src- The location of the error. For example, a file name and a line number. Ifsrcis a string, it is used to describe the source. Otherwise, the name of the object class is used.flags- TheDefaultLogmessage type.message- The message to log.buf- The array of bytes to append to the message.off- Offset into the buffer; the position at which to start the hex dump.len- Number ofbufbytes to log.
-
log
Logs information to the default log file.- Parameters:
src- The location of the error. For example, a file name and a line number. Ifsrcis a string, it is used to describe the source. Otherwise, the name of the object class is used.flags- TheDefaultLogmessage type.message- The message to log.
-
getLog
Retrieves theDefaultLogas anInputStream.- Returns:
- An
InputStreamof theDefaultLogobject.
-
isLogInMemory
public static boolean isLogInMemory()Determines if the message logged is stored in memory rather than on disk.- Returns:
trueif the log is in memory.
-
doLog
public static boolean doLog(int control) Evaluates the control level to determine whether a log call will result in a log entry.- Parameters:
control- The log message flag that would be passed to the log method.- Returns:
trueif the specified control level permits writing to the log file.
-