|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opengts.util.Print
public class Print
Performs message logging
| Nested Class Summary | |
|---|---|
static class |
Print.NullOutputStream
OutputStream subclass which ignores all output. |
static class |
Print.NullPrintStream
PrintStream subclass which ignores all output |
static class |
Print.RedirectStream
Abstract class to provide log print redirection |
| Field Summary | |
|---|---|
static int |
LOG_ALL
|
static int |
LOG_DEBUG
|
static int |
LOG_ERROR
|
static int |
LOG_FATAL
|
static int |
LOG_INFO
|
static int |
LOG_OFF
|
static int |
LOG_UNDEFINED
|
static int |
LOG_WARN
|
| Constructor Summary | |
|---|---|
Print()
|
|
| Method Summary | |
|---|---|
static void |
_debugProbe(java.lang.String msg,
java.lang.Object... args)
Prints the specified message (with stack-frame) to stderr. Used for temporary debug purposes, should not be included in production code. |
protected static boolean |
_emailExceptions()
Returns true if exceptions should be emailed to the recipient on file |
static java.lang.String |
_getStackFrame(int frame)
Returns a String representation of offset frame within the current stackframe. |
protected static boolean |
_includeDate()
Returns true if the date/time is to be included on log messages |
protected static boolean |
_includeStackFrame()
Returns true if the stack frame is to be included on log messages |
static void |
_log(int level,
int frame,
java.lang.String msg,
java.lang.Object... args)
Logs the specified message with the specified debug level |
protected static void |
_logStackTrace(int level,
int frame,
java.lang.String msg,
java.lang.Throwable t)
Logs a stack trace with the specified message to the output file |
protected static void |
_print(java.io.PrintStream ps,
int frame,
boolean printFrame,
java.lang.String msg,
java.lang.Object... args)
Prints the message and optional arguments to the specified PrintStream |
protected static void |
_print(java.io.PrintStream ps,
int frame,
java.lang.String msg,
java.lang.Object... args)
Prints the message and optional arguments to the specified PrintStream |
protected static void |
_println(java.io.PrintStream ps,
int frame,
boolean printFrame,
java.lang.String msg,
java.lang.Object... args)
Prints the message and optional arguments to the specified PrintStream |
protected static void |
_println(java.io.PrintStream ps,
int frame,
java.lang.String msg,
java.lang.Object... args)
Prints the message and optional arguments to the specified PrintStream |
static void |
_println(java.io.PrintStream ps,
java.lang.String msg,
java.lang.Object... args)
Prints the message and optional arguments to the specified PrintStream |
static void |
_println(java.lang.String msg,
java.lang.Object... args)
Prints the message and optional arguments to 'stdout'. |
static void |
_printStackTrace(java.io.PrintStream out,
int frame,
java.lang.String msg,
java.lang.Throwable t)
Prints a stack trace with the specified message |
static void |
_writeLog(int level,
java.lang.String logMsg)
Writes the specified log message to the output file |
protected static void |
closePrintStream()
Closes the output PrintStream |
static void |
closeRedirectedOutputStream()
Closes the redirected output stream. |
static void |
errPrint(java.lang.StringBuffer msg,
java.lang.Object... args)
Prints the specified message to stderr (no extra line terminator is included) The stack-frame is ommitted. |
static void |
errPrint(java.lang.String msg,
java.lang.Object... args)
Prints the specified message to stderr (no extra line terminator is included) The stack-frame is ommitted. |
static void |
errPrintln(java.lang.StringBuffer msg,
java.lang.Object... args)
Prints the specified message to stderr (includes the line-terminator '\n') The stack-frame is ommitted. |
static void |
errPrintln(java.lang.String msg,
java.lang.Object... args)
Prints the specified message to stderr (includes the line-terminator '\n') The stack-frame is ommitted. |
static java.lang.String |
formatDate(java.lang.String fmt)
Formats the current data/time per the specified format specification |
static java.lang.String |
getEncoding()
Gets the character encoding for the Printed text output |
static java.lang.String |
getHostName()
Gets the host name for this systenm |
static java.io.File |
getLogFile()
Gets the output log file |
static int |
getLogHeaderLevel()
Gets the log header level. |
static int |
getLogLevel()
Gets the log level. |
static java.lang.String |
getLogLevelString(int level)
Gets the string name of the log level represented by the specified log level index. |
static java.io.OutputStream |
getRedirectedOutputStream()
Gets the instantiated redirect OutputStream |
static long |
getRotateDeleteAgeSec()
Gets the maximum age of rotated log files (in seconds) |
static long |
getRotateLogFileSize()
Gets the maximum output log file size (in bytes). |
static boolean |
hasLogPrintStream()
Returns true if an override log PrintStream has been defined |
static boolean |
isDebugLoggingLevel()
Returns true if the logging level is greater or equal to the debug level, LOG_DEBUG |
static boolean |
isRemoteLogging()
Returns true if RemoteLogging has been enabled |
static void |
log(int level,
java.lang.String msg)
Logs the specified message with the specified level |
static void |
logDebug(java.lang.String msg,
java.lang.Object... args)
Logs the specified message with a debug level |
static void |
logError(java.lang.String msg,
java.lang.Object... args)
Logs the specified message with an error level |
static void |
logException(java.lang.String msg,
java.lang.Throwable t)
Logs a general error with the specified message and a stack trace to the output file |
static void |
logFatal(java.lang.String msg,
java.lang.Object... args)
Logs the specified message with a fatal level |
static void |
logInfo(java.lang.String msg,
java.lang.Object... args)
Logs the specified message with an info level |
static void |
logNotImplemented(java.lang.String msg)
Logs a "Feature Not Implemented" error with the specified message and a stack trace to the output file |
static void |
logSQLError(int frame,
java.lang.String msg,
java.sql.SQLException sqe)
Logs an SQL Error with the specified messasge and a stack trace to the output file |
static void |
logSQLError(java.sql.SQLException sqe)
Logs an SQL Error with the specified messasge and a stack trace to the output file |
static void |
logSQLError(java.lang.String msg,
java.sql.SQLException sqe)
Logs an SQL Error with the specified messasge and a stack trace to the output file |
static void |
logStackTrace(java.lang.String msg)
Logs a warning level stack trace with the specified message to the output file |
static void |
logStackTrace(java.lang.String msg,
java.lang.Throwable t)
Logs an error level stack trace with the specified message to the output file |
static void |
logStackTrace(java.lang.Throwable t)
Logs an error level stack trace to the output file |
static void |
logWarn(java.lang.String msg,
java.lang.Object... args)
Logs the specified message with a warning level |
static void |
main(java.lang.String[] argv)
Main entry point for testing/debugging |
protected static java.io.PrintStream |
openPrintStream()
Opens the output log file (does not return null) |
static int |
parseLogLevel(java.lang.String val,
int dft)
Parses a log level integer value from a specified string integer value or log level name |
static void |
print(java.lang.StringBuffer msg,
java.lang.Object... args)
Prints the specified message to stdout (no extra line terminator is included) The stack-frame is ommitted. |
static void |
print(java.lang.String msg,
java.lang.Object... args)
Prints the specified message to stdout (no extra line terminator is included) The stack-frame is ommitted. |
static void |
println(java.lang.StringBuffer msg,
java.lang.Object... args)
Prints the specified message to stdout (includes the line-terminator '\n') The stack-frame is ommitted. |
static void |
println(java.lang.String msg,
java.lang.Object... args)
Prints the specified message to stdout (includes the line-terminator '\n') The stack-frame is ommitted. |
static void |
resetVars()
Resets all print logging settings. |
static void |
setAllOutputToStdout(boolean state)
Set all output to stderr to be sent to stdout. |
static void |
setEncoding(java.lang.String enc)
Sets the character encoding for the Printed text output |
static int |
setIncludeStackFrame(int inclFrameState)
Sets the "includeStackFrame" state. |
static void |
setLogFile(java.io.File file)
Sets the output log file |
static void |
setLogHeaderLevel(int level)
Sets the log header level. |
static void |
setLogLevel(int level)
Sets the log level. |
static void |
setLogLevel(int level,
boolean inclDate,
boolean inclFrame)
Sets the log level and some other log settings. |
static void |
setLogStream(java.io.PrintStream out)
Sets the override PrintStream used for logging |
static void |
setRedirectedOutput(java.io.OutputStream os)
Redirects all redirectable output to the specified OutputStream |
static void |
setRedirectedOutput(java.io.PrintStream out)
Redirects all redirectable output to the specified PrintStream |
static boolean |
setRemoteLogging(java.net.InetAddress bindAddr,
int port,
int buffSize)
Sets the remote log port, and starts the RemoteLogServer |
static boolean |
setRemoteLogging(int port,
int buffSize)
Sets the remote log port, and starts the RemoteLogServer |
static boolean |
setRemoteLogging(java.lang.String remLog)
Sets the remote log host:port and buffer size, and starts the RemoteLogServer |
static boolean |
setRemoteLogging(java.lang.String bindHost,
int port,
int buffSize)
Sets the remote log port, and starts the RemoteLogServer |
static void |
setRotateDeleteAgeSec(long delAgeSec)
Sets the rotated log file delete age (in seconds) |
static void |
setRotateLogFileSize(long maxSize)
Sets the maximum output log file size (in bytes). |
static void |
setSysStderr(java.io.PrintStream out)
Sets the stderr PrintStream |
static void |
setSysStdout(java.io.PrintStream out)
Sets the stdout PrintStream |
static void |
sysPrint(java.lang.StringBuffer msg,
java.lang.Object... args)
Prints the specified message to stdout (no extra line terminator is included) The stack-frame is ommitted. |
static void |
sysPrint(java.lang.String msg,
java.lang.Object... args)
Prints the specified message to stdout (no extra line terminator is included) The stack-frame is ommitted. |
static void |
sysPrintln(java.lang.StringBuffer msg,
java.lang.Object... args)
Prints the specified message to stdout (includes the line-terminator '\n') The stack-frame is ommitted. |
static void |
sysPrintln(java.lang.String msg,
java.lang.Object... args)
Prints the specified message to stdout (includes the line-terminator '\n') The stack-frame is ommitted. |
static void |
sysStackTrace(java.lang.String msg)
Prints the specified message and current stacktrace to stdout (includes the line-terminator '\n') The stack-frame is ommitted. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LOG_UNDEFINED
public static final int LOG_OFF
public static final int LOG_FATAL
public static final int LOG_ERROR
public static final int LOG_WARN
public static final int LOG_INFO
public static final int LOG_DEBUG
public static final int LOG_ALL
| Constructor Detail |
|---|
public Print()
| Method Detail |
|---|
public static void resetVars()
public static int setIncludeStackFrame(int inclFrameState)
inclFrameState - "1" to include stackframe,
"0" to omit stackframe,
"-1" to set undefined (will be set based on other criteria).protected static boolean _includeStackFrame()
protected static boolean _includeDate()
protected static boolean _emailExceptions()
public static java.lang.String getHostName()
public static java.lang.String formatDate(java.lang.String fmt)
fmt - The date/time format specification
public static void setEncoding(java.lang.String enc)
enc - The character encodingpublic static java.lang.String getEncoding()
public static java.lang.String _getStackFrame(int frame)
frame - The current frame offset
public static void _println(java.lang.String msg,
java.lang.Object... args)
msg - The message (or message format)args - The optional message format arguments
public static void _println(java.io.PrintStream ps,
java.lang.String msg,
java.lang.Object... args)
ps - The output PrintStreammsg - The message (or message format)args - The optional message format arguments
protected static void _println(java.io.PrintStream ps,
int frame,
boolean printFrame,
java.lang.String msg,
java.lang.Object... args)
ps - The output PrintStreamframe - The current frame offset used to tag this messageprintFrame - True to print the current stackframemsg - The message (or message format)args - The optional message format arguments
protected static void _println(java.io.PrintStream ps,
int frame,
java.lang.String msg,
java.lang.Object... args)
ps - The output PrintStreamframe - The current frame offset used to tag this messagemsg - The message (or message format)args - The optional message format arguments
protected static void _print(java.io.PrintStream ps,
int frame,
java.lang.String msg,
java.lang.Object... args)
ps - The output PrintStreamframe - The current frame offset used to tag this messagemsg - The message (or message format)args - The optional message format arguments
protected static void _print(java.io.PrintStream ps,
int frame,
boolean printFrame,
java.lang.String msg,
java.lang.Object... args)
ps - The output PrintStreamframe - The current frame offset used to tag this messageprintFrame - True to print the current stackframemsg - The message (or message format)args - The optional message format argumentspublic static void setLogStream(java.io.PrintStream out)
out - The PrintStreampublic static boolean hasLogPrintStream()
public static void closeRedirectedOutputStream()
public static java.io.OutputStream getRedirectedOutputStream()
public static void setRedirectedOutput(java.io.OutputStream os)
os - The OutputStreampublic static void setRedirectedOutput(java.io.PrintStream out)
out - The PrintStreampublic static boolean setRemoteLogging(java.lang.String remLog)
remLog - The remote logging attributes of the form "[[HOST]:]PORT[/BUFFERSIZE]"
public static boolean setRemoteLogging(int port,
int buffSize)
port - The port on which to listen for incoming log requestsbuffSize - The maximum log buffer size
public static boolean setRemoteLogging(java.lang.String bindHost,
int port,
int buffSize)
bindHost - The local network interface on which the remote log server will be bound.port - The port on which to listen for incoming log requestsbuffSize - The maximum log buffer size
public static boolean setRemoteLogging(java.net.InetAddress bindAddr,
int port,
int buffSize)
bindAddr - The local network interface on which the remote log server will be bound.port - The port on which to listen for incoming log requestsbuffSize - The maximum log buffer sizepublic static boolean isRemoteLogging()
public static void setAllOutputToStdout(boolean state)
state - True to send stderr output to stdoutpublic static void setSysStdout(java.io.PrintStream out)
out - The PrintStream to use for stdoutpublic static void setSysStderr(java.io.PrintStream out)
out - The PrintStream to use for stderr
public static void sysPrint(java.lang.String msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void sysPrint(java.lang.StringBuffer msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void sysPrintln(java.lang.String msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void sysPrintln(java.lang.StringBuffer msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message argumentspublic static void sysStackTrace(java.lang.String msg)
msg - The message to print
public static void errPrint(java.lang.String msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void errPrint(java.lang.StringBuffer msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void errPrintln(java.lang.String msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void errPrintln(java.lang.StringBuffer msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void _debugProbe(java.lang.String msg,
java.lang.Object... args)
msg - The message to print
public static void print(java.lang.String msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void print(java.lang.StringBuffer msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void println(java.lang.String msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
public static void println(java.lang.StringBuffer msg,
java.lang.Object... args)
msg - The message to printargs - Any associated message arguments
protected static void _logStackTrace(int level,
int frame,
java.lang.String msg,
java.lang.Throwable t)
level - The log level of this trace. The log will only be printed
if this value is same of greater than the current log levelframe - The current frame offset used to tag this messagemsg - The message to logt - The throwable to get the stack trace from
public static void _printStackTrace(java.io.PrintStream out,
int frame,
java.lang.String msg,
java.lang.Throwable t)
frame - The current frame offset used to tag this messagemsg - The message to printt - The throwable to get the stack trace frompublic static void logNotImplemented(java.lang.String msg)
msg - The message to log
public static void logException(java.lang.String msg,
java.lang.Throwable t)
msg - The message to logt - The throwable to get the stack trace from
public static void logStackTrace(java.lang.String msg,
java.lang.Throwable t)
msg - The message to logt - The throwable to get the stack trace frompublic static void logStackTrace(java.lang.Throwable t)
t - The throwable to get the stack trace frompublic static void logStackTrace(java.lang.String msg)
msg - The message to log
public static void logSQLError(int frame,
java.lang.String msg,
java.sql.SQLException sqe)
frame - The current frame offset used to tag this messagemsg - The message to logsqe - The SQLException to logpublic static void logSQLError(java.sql.SQLException sqe)
sqe - The SQLException to log
public static void logSQLError(java.lang.String msg,
java.sql.SQLException sqe)
msg - The message to logsqe - The SQLException to logpublic static void setLogFile(java.io.File file)
file - The output log filepublic static java.io.File getLogFile()
public static void setRotateLogFileSize(long maxSize)
maxSize - The maximum size (in bytes)public static long getRotateLogFileSize()
public static void setRotateDeleteAgeSec(long delAgeSec)
delAgeSec - The rotated log file delete age (in seconds)public static long getRotateDeleteAgeSec()
protected static java.io.PrintStream openPrintStream()
protected static void closePrintStream()
public static void setLogLevel(int level,
boolean inclDate,
boolean inclFrame)
level - The log levelinclDate - True if the date/time should be included in the log tracesinclFrame - True if a stack frame trace should be included in log
tracespublic static void setLogLevel(int level)
level - The log levelpublic static int getLogLevel()
RTConfig will be returned.
public static boolean isDebugLoggingLevel()
LOG_DEBUG
public static void setLogHeaderLevel(int level)
level - The log header levelpublic static int getLogHeaderLevel()
public static java.lang.String getLogLevelString(int level)
level - The log level
public static int parseLogLevel(java.lang.String val,
int dft)
val - The string value to parsedft - The default value to return if a recognized value could not
be parsed
dft
public static void log(int level,
java.lang.String msg)
level - The log levelmsg - The message to log
public static void logFatal(java.lang.String msg,
java.lang.Object... args)
msg - The message to logargs - Any arguments referenced by any format specifiers in
msgString.format(java.lang.String, java.lang.Object...)
public static void logError(java.lang.String msg,
java.lang.Object... args)
msg - The message to logargs - Any arguments referenced by any format specifiers in
msgString.format(java.lang.String, java.lang.Object...)
public static void logWarn(java.lang.String msg,
java.lang.Object... args)
msg - The message to logargs - Any arguments referenced by any format specifiers in
msgString.format(java.lang.String, java.lang.Object...)
public static void logInfo(java.lang.String msg,
java.lang.Object... args)
msg - The message to logargs - Any arguments referenced by any format specifiers in
msgString.format(java.lang.String, java.lang.Object...)
public static void logDebug(java.lang.String msg,
java.lang.Object... args)
msg - The message to logargs - Any arguments referenced by any format specifiers in
msgString.format(java.lang.String, java.lang.Object...)
public static void _log(int level,
int frame,
java.lang.String msg,
java.lang.Object... args)
level - The log levelframe - The current frame offset used to tag this messagemsg - The message to logargs - Any arguments referenced by any format specifiers in
msgString.format(java.lang.String, java.lang.Object...)
public static void _writeLog(int level,
java.lang.String logMsg)
level - The log levellogMsg - The message to write to the logpublic static void main(java.lang.String[] argv)
argv - Comand-line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||