|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.epicentric.common.FileLog
This implementation of LogInterface writes output to a sequential file. When the file is closed, it can be renamed to the same file name with a different extension. By default, the extensions are the same (.txt).
| Field Summary | |
protected String |
adminAddress
Deprecated. |
protected int |
adminLevel
Deprecated. |
protected String |
closedFileExtension
Deprecated. |
protected File |
curFile
Deprecated. |
protected int |
curLevel
Deprecated. |
protected File |
curPath
Deprecated. |
protected boolean |
echo
Deprecated. |
protected boolean |
logToFile
Deprecated. |
protected long |
maxBytes
Deprecated. |
protected int |
maxDays
Deprecated. |
protected int |
maxFiles
Deprecated. |
protected String |
openFileExtension
Deprecated. |
protected int |
paramLevel
Deprecated. |
protected PrintStream |
pstream
Deprecated. |
protected boolean |
redirectStdErr
Deprecated. |
protected boolean |
redirectStdOut
Deprecated. |
protected File |
renameToFile
Deprecated. |
protected com.epicentric.common.internal.Semaphore |
semaphore
Deprecated. |
boolean |
stackTrace
Deprecated. |
protected long |
startDate
Deprecated. |
protected static PrintStream |
system_err
Deprecated. |
protected static PrintStream |
system_out
Deprecated. |
protected boolean |
useDateTimeStamp
Deprecated. |
protected boolean |
useSeverityStamp
Deprecated. |
protected boolean |
useThreadName
Deprecated. |
protected com.epicentric.common.FileLog.CountingWriter |
writer
Deprecated. |
| Fields inherited from interface com.epicentric.common.LogConstants |
kCritical, kDebug, kDefault, kDevDebug, kDoNotOverrideFileInstruction, kError, kFileLogging, kNoFileLogging, kNone, kStatus, kUndefined, kWarning |
| Constructor Summary | |
FileLog()
Deprecated. Construct, using properties to determine whether logging is done or not. |
|
FileLog(int fileInstruction)
Deprecated. Construct, accepting instruction to override the log_to_file value in System.properties. |
|
FileLog(Properties props)
Deprecated. Construct, using properties to determine whether logging is done or not. |
|
FileLog(String openFileExtension,
String closedFileExtension)
Deprecated. Constructor. |
|
| Method Summary | |
protected void |
checkLevel(int level,
boolean allowNone)
Deprecated. kUndefined will cause an exception. |
void |
close()
Deprecated. Orderly shutdown. |
protected void |
finalize()
Deprecated. |
void |
forceLogToStandardOut()
Deprecated. after this call, all logging will go to go to the system output stream (console). |
String |
getDateTimeStampSeparator()
Deprecated. Return the current string used as dateTimeStamp separator. |
int |
getLevel()
Deprecated. |
String |
getLocalEmailAddress()
Deprecated. |
protected String |
getStackPosition()
Deprecated. this is not efficient. |
String |
getThreadNameSeparator()
Deprecated. Return the current string used as threadName separator. |
protected boolean |
isErrorLevel(int level)
Deprecated. |
protected boolean |
isOpen()
Deprecated. Check whether file is open. |
boolean |
isStdErrRedirected()
Deprecated. Answer whether stderr is redirected to the log file. |
boolean |
isStdOutRedirected()
Deprecated. Answer whether stdout is redirected to the log file. |
boolean |
logToFile()
Deprecated. Return whether logging to file is enabled. |
protected void |
maybeRollover()
Deprecated. Roll over if # days or size limit has been exceeded. |
void |
msg(int level,
String msg)
Deprecated. Log msg at given level. |
void |
msg(int level,
String msg,
Throwable thrown)
Deprecated. Log msg at given level. |
void |
msg(String msg)
Deprecated. Log message. |
protected int |
parseLevel(String str)
Deprecated. |
protected void |
purgeOldFiles()
Deprecated. Look for files in excess of the maximum allowed number, and purge oldest ones. |
void |
redirectStdErr()
Deprecated. after this call, all calls to System.err will end up going to the log's PrintStream. |
void |
redirectStdOut()
Deprecated. after this call, all calls to System.out will end up going to the log's PrintStream. |
void |
restoreStdErr()
Deprecated. after this call, all calls to System.err will go to the system error stream (console). |
void |
restoreStdOut()
Deprecated. after this call, all calls to System.out will go to the system output stream (console). |
void |
rollover()
Deprecated. convenience routine to set up the file. |
protected void |
sendAdminNotice(int level,
String msg)
Deprecated. |
void |
setAdminNoticeAddress(String adr)
Deprecated. |
void |
setAdminNoticeLevel(int level)
Deprecated. |
void |
setClosedFileExtension(String closedFileExtension)
Deprecated. Sets the extension to which log file should be renamed when file closed. |
void |
setDateTimeStampSeparator(String separator)
Deprecated. Set the delimiting string to be used to separate the dateTimeStamp from the text to follow. |
void |
setEcho(boolean b)
Deprecated. |
void |
setLevel(int level)
Deprecated. |
void |
setMaxFileCount(int count)
Deprecated. Set maximum # of files to retain in directory. |
void |
setOpenFileExtension(String openFileExtension)
Deprecated. Sets the extension to use when log file is open. |
void |
setPath(File path)
Deprecated. |
void |
setPath(String path)
Deprecated. |
void |
setRolloverDays(int days)
Deprecated. |
void |
setRolloverSize(int bytes)
Deprecated. |
void |
setStackTrace(boolean b)
Deprecated. Determines whether a logged exception will print the stack trace |
void |
setThreadNameSeparator(String separator)
Deprecated. Set the delimiting string to be used to separate the threadName from the text to follow. |
void |
setUseDateTimeStamp(boolean useDateTimeStamp)
Deprecated. Set whether all msgs are preceded by date/time stamp. |
void |
setUseThreadName(boolean useThreadName)
Deprecated. Set whether all msgs are preceded by thread name. |
protected File |
toCanonicalFile(File fold)
Deprecated. |
protected File |
toCanonicalFile(String fileName)
Deprecated. prepends the current log path to param fileName. |
protected String |
toLevelString(int level)
Deprecated. |
boolean |
usingDateTimeStamp()
Deprecated. Return whether using dateTimeStamp |
boolean |
usingThreadName()
Deprecated. Return whether using threadName |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public boolean stackTrace
protected int paramLevel
protected int curLevel
protected int adminLevel
protected boolean echo
protected String adminAddress
protected long maxBytes
protected int maxDays
protected long startDate
protected int maxFiles
protected File curPath
protected File curFile
protected File renameToFile
protected boolean logToFile
protected boolean redirectStdOut
protected boolean redirectStdErr
protected boolean useDateTimeStamp
protected boolean useThreadName
protected boolean useSeverityStamp
protected String openFileExtension
protected String closedFileExtension
protected static PrintStream system_out
protected static PrintStream system_err
protected PrintStream pstream
protected com.epicentric.common.FileLog.CountingWriter writer
protected com.epicentric.common.internal.Semaphore semaphore
| Constructor Detail |
public FileLog()
throws LogException
public FileLog(Properties props)
throws LogException
props - The properties object from which to derive logging properties.
public FileLog(String openFileExtension,
String closedFileExtension)
throws LogException
openFileExtension - extension with which to open the file.closedFileExtension - extension to rename the file to when closed.
public FileLog(int fileInstruction)
throws LogException
fileInstruction - one of FILE_LOGGING or NO_FILE_LOGGING| Method Detail |
protected boolean isOpen()
throws LogException
protected void finalize()
throws Throwable
finalize in class Object
protected String toLevelString(int level)
throws LogException
protected int parseLevel(String str)
public void close()
close in interface LogInterface
protected File toCanonicalFile(String fileName)
throws IOException
fileName - must not contain any path information.
protected File toCanonicalFile(File fold)
throws IOException
public void rollover()
throws IOException
rollover in interface LogInterface
protected void purgeOldFiles()
throws IOException
protected void maybeRollover()
throws IOException
protected void checkLevel(int level,
boolean allowNone)
throws LogException
protected boolean isErrorLevel(int level)
public void setEcho(boolean b)
setEcho in interface LogInterfacecom.epicentric.common.LogInterfaceb - true means that also send any msg()s to System.out
(if it's not an error level message) or Sytem.err (if it
is an error level message).LogInterface.msg(java.lang.String)public void setStackTrace(boolean b)
LogInterfacesetStackTrace in interface LogInterface
public void setPath(String path)
throws IOException
setPath in interface LogInterfacecom.epicentric.common.LogInterfacepath - is a currently existing directory into which the log files will be written.public void setPath(File path)
public void setLevel(int level)
throws LogException
setLevel in interface LogInterfacelevel - will be ignored if there is a value from
properties.txt. (so the person actually running the program
will have the final say on the level of log messages).public int getLevel()
getLevel in interface LogInterfacecom.epicentric.common.LogInterfacepublic void setRolloverSize(int bytes)
setRolloverSize in interface LogInterfacecom.epicentric.common.LogInterfacebytes - is the maximum size an individual log file can grow to be. once
reached, the log file will be closed and a new file will be started.public void setRolloverDays(int days)
setRolloverDays in interface LogInterfacecom.epicentric.common.LogInterfacedays - is the maximum age in days that a log file is allowed to be.
once reaced, the log file will be closed and a new file will be started.public void setMaxFileCount(int count)
setMaxFileCount in interface LogInterfacefileCount, - or -1 to keep all files.public void setOpenFileExtension(String openFileExtension)
public void setClosedFileExtension(String closedFileExtension)
public void setAdminNoticeAddress(String adr)
setAdminNoticeAddress in interface LogInterfacecom.epicentric.common.LogInterfaceadr - is an email address to direct error messages to, if
that feature is enabled (by properties.txt).
public void setAdminNoticeLevel(int level)
throws LogException
setAdminNoticeLevel in interface LogInterfacecom.epicentric.common.LogInterfacelevel - is the level at which the administrator should
receive email notification. currently only allows kNone or
kCritical - any higher settings will revert to kCritical.protected String getStackPosition()
public String getLocalEmailAddress()
getLocalEmailAddress in interface LogInterfacecom.epicentric.common.LogInterface
protected void sendAdminNotice(int level,
String msg)
public void forceLogToStandardOut()
LogInterfaceforceLogToStandardOut in interface LogInterfacepublic void redirectStdOut()
LogInterfaceredirectStdOut in interface LogInterfacepublic void redirectStdErr()
LogInterfaceredirectStdErr in interface LogInterfacepublic void restoreStdOut()
LogInterfacerestoreStdOut in interface LogInterfacepublic void restoreStdErr()
LogInterfacerestoreStdErr in interface LogInterfacepublic void msg(String msg)
msg in interface LogInterface
public void msg(int level,
String msg)
msg in interface LogInterfacecom.epicentric.common.LogInterfacelevel - is one of kCritical ... kDevDebug. kNone is not valid.msg - is the String to echo if the current active logging
level is greater than or equal to param level.LogInterface.setEcho(boolean)
public void msg(int level,
String msg,
Throwable thrown)
msg in interface LogInterfacepublic boolean isStdOutRedirected()
isStdOutRedirected in interface LogInterfacepublic boolean isStdErrRedirected()
isStdErrRedirected in interface LogInterfacepublic boolean logToFile()
logToFile in interface LogInterfacepublic void setUseDateTimeStamp(boolean useDateTimeStamp)
setUseDateTimeStamp in interface LogInterfacepublic boolean usingDateTimeStamp()
usingDateTimeStamp in interface LogInterfacepublic void setDateTimeStampSeparator(String separator)
public String getDateTimeStampSeparator()
public void setUseThreadName(boolean useThreadName)
public boolean usingThreadName()
public void setThreadNameSeparator(String separator)
public String getThreadNameSeparator()
|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||