|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.denova.io.Log
Record messages to a log, if the log file exists. This is a great diagnostic tool that allows you to have debugging messages in your custom classes which only appear if a customer is having a problem and they create the appropriately named log file. All log files end with .log and are case sensitive. Copyright © 1997-2008 DeNova All rights reserved worldwide. Last modified: 2008.04.15
| Constructor Summary | |
Log(java.io.File directory,
java.lang.String logName)
Records messages in a text file. |
|
Log(java.lang.String logName)
Records messages in a text file in the user's directory as defined by the System properties. |
|
Log(java.lang.String directory,
java.lang.String logName)
Records messages in a text file. |
|
| Method Summary | |
void |
end()
Closes the log file and stops logging until startLogging() called. |
void |
flush()
Forces the file system to save all messages to disk. |
com.denova.io.Log |
getAlsoLogTo()
Returns an alternate log file where messages are being saved. |
static boolean |
getAlwaysFlush()
Get whether to write the buffer to disk after every update or not. |
static java.lang.String |
getLogDir()
Get the name of the directory where logs are. |
boolean |
getLogging()
Returns true if logging forced, even if file does not exist. |
com.denova.ui.TextDisplayable |
getStatusDisplay()
Returns the text display area that was set with setStatusDisplay(). |
static boolean |
getUseTempDirectory()
Get whether to write the log in a temporary directory or not. |
boolean |
logFileExists()
Returns true iff log file exists. |
void |
setAlsoLogTo(com.denova.io.Log log2)
Lets you save the same messages to another log file. |
static void |
setAlwaysFlush(boolean flush)
Set whether to write the buffer to disk after every update or not. |
static void |
setLogDir(java.lang.String dirname)
Sets the directory where to save log files. |
void |
setLogging(boolean logNow)
Set whether to record log messages. |
void |
setStatusDisplay(com.denova.ui.TextDisplayable where)
Sets a displayable window for write() calls. |
static void |
setUseTempDirectory(boolean use)
Set whether to write the log in a temporary directory or not. |
void |
startLogging()
Starts logging so all future calls to write() save the messages. |
void |
stopLogging()
Closes log file and stops logging. |
void |
write(java.lang.Exception e)
Saves the text from a Exception exception to the log file. |
void |
write(java.lang.String s)
Saves a message to the log file. |
void |
write(java.lang.Throwable e)
Saves the text from a Throwable exception to the log file. |
void |
write(java.lang.Throwable e,
java.lang.String msg)
Saves a message and the text from an exception to the log file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Log(java.lang.String directory,
java.lang.String logName)
If the file exists, then messages are appended to the file.
Messages are only saved in the file if the file already exists when
Log instantiated or you call startLogging ().
directory - to write log.logName - filename of log, without path.
public Log(java.io.File directory,
java.lang.String logName)
If the file exists, then messages are appended to the file.
Messages are only saved in the file if the file already exists when
Log instantiated or you call startLogging ().
directory - where to store log.logName - filename of log, without path.public Log(java.lang.String logName)
If the file exists, then messages are appended to the file.
Messages are only saved in the file if the file already exists when
Log instantiated or you call startLogging ().
logName - filename of log, without path.| Method Detail |
public static void setLogDir(java.lang.String dirname)
dirname - name of directory.public static java.lang.String getLogDir()
public static void setAlwaysFlush(boolean flush)
flush - state of whether to flush the logpublic static boolean getAlwaysFlush()
public static void setUseTempDirectory(boolean use)
use - true if you want the log created in a temporary directory.public static boolean getUseTempDirectory()
public void end()
public void write(java.lang.String s)
Logging must be enabled when you call this member function. Logging is automatically enabled if the file exists when you instantiate Log or you invoke startLogging() or setLogging( true ).
s - messagepublic void write(java.lang.Exception e)
Logging must be enabled when you call this member function. Logging is automatically enabled if the file exists when you instantiate Log or you invoke startLogging().
e - exception errorpublic void write(java.lang.Throwable e)
Logging must be enabled when you call this member function. Logging is automatically enabled if the file exists when you instantiate Log or you invoke startLogging().
e - throwable error
public void write(java.lang.Throwable e,
java.lang.String msg)
Logging must be enabled when you call this member function. Logging is automatically enabled if the file exists when you instantiate Log or you invoke startLogging().
e - exception errormsg - message about errorpublic boolean getLogging()
public void setLogging(boolean logNow)
logNow - The new logging valuepublic com.denova.ui.TextDisplayable getStatusDisplay()
Returns null if setStatusDisplay() was never called.
public void setStatusDisplay(com.denova.ui.TextDisplayable where)
When logging is active, then all calls to write() also display in text display area.
where - The new statusDisplay valuepublic com.denova.io.Log getAlsoLogTo()
If setAlsoLogTo() wasn't called previously, then returns null.
public void setAlsoLogTo(com.denova.io.Log log2)
log2 - The new alsoLogTo valuepublic void startLogging()
If the log file doesn't exist, then it automatically creates it.
If the log file does exist, then all messages will be appended to it.
public void stopLogging()
All future calls to write() are ignored.
public void flush()
public boolean logFileExists()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||