02/28/2005
 

com.epicentric.common
Class FileLog

java.lang.Object
  |
  +--com.epicentric.common.FileLog
All Implemented Interfaces:
LogConstants, LogInterface

Deprecated. as of version 4.5, to be removed in 8.0 or later. Logging functionality has been moved to the package com.vignette.portal.log.

public class FileLog
extends Object
implements LogInterface

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

stackTrace

public boolean stackTrace
Deprecated. 

paramLevel

protected int paramLevel
Deprecated. 

curLevel

protected int curLevel
Deprecated. 

adminLevel

protected int adminLevel
Deprecated. 

echo

protected boolean echo
Deprecated. 

adminAddress

protected String adminAddress
Deprecated. 

maxBytes

protected long maxBytes
Deprecated. 

maxDays

protected int maxDays
Deprecated. 

startDate

protected long startDate
Deprecated. 

maxFiles

protected int maxFiles
Deprecated. 

curPath

protected File curPath
Deprecated. 

curFile

protected File curFile
Deprecated. 

renameToFile

protected File renameToFile
Deprecated. 

logToFile

protected boolean logToFile
Deprecated. 

redirectStdOut

protected boolean redirectStdOut
Deprecated. 

redirectStdErr

protected boolean redirectStdErr
Deprecated. 

useDateTimeStamp

protected boolean useDateTimeStamp
Deprecated. 

useThreadName

protected boolean useThreadName
Deprecated. 

useSeverityStamp

protected boolean useSeverityStamp
Deprecated. 

openFileExtension

protected String openFileExtension
Deprecated. 

closedFileExtension

protected String closedFileExtension
Deprecated. 

system_out

protected static PrintStream system_out
Deprecated. 

system_err

protected static PrintStream system_err
Deprecated. 

pstream

protected PrintStream pstream
Deprecated. 

writer

protected com.epicentric.common.FileLog.CountingWriter writer
Deprecated. 

semaphore

protected com.epicentric.common.internal.Semaphore semaphore
Deprecated. 
Constructor Detail

FileLog

public FileLog()
        throws LogException
Deprecated. 
Construct, using properties to determine whether logging is done or not. Use default extensions.

FileLog

public FileLog(Properties props)
        throws LogException
Deprecated. 
Construct, using properties to determine whether logging is done or not. Use default extensions.
Parameters:
props - The properties object from which to derive logging properties.

FileLog

public FileLog(String openFileExtension,
               String closedFileExtension)
        throws LogException
Deprecated. 
Constructor. Accepts extensions allowing the file to be renamed when closed. Use this constructor when you want extensions other than the defaults, "txt" and "txt". For both extensions, omit the "." (e.g. "txt", not ".txt")
Parameters:
openFileExtension - extension with which to open the file.
closedFileExtension - extension to rename the file to when closed.

FileLog

public FileLog(int fileInstruction)
        throws LogException
Deprecated. 
Construct, accepting instruction to override the log_to_file value in System.properties.
Parameters:
fileInstruction - one of FILE_LOGGING or NO_FILE_LOGGING
Method Detail

isOpen

protected boolean isOpen()
                  throws LogException
Deprecated. 
Check whether file is open. If not open yet, try to open it. Return true if open when done.

finalize

protected void finalize()
                 throws Throwable
Deprecated. 
Overrides:
finalize in class Object

toLevelString

protected String toLevelString(int level)
                        throws LogException
Deprecated. 

parseLevel

protected int parseLevel(String str)
Deprecated. 

close

public void close()
Deprecated. 
Orderly shutdown. Close the print stream. Rename log file if called for.
Specified by:
close in interface LogInterface

toCanonicalFile

protected File toCanonicalFile(String fileName)
                        throws IOException
Deprecated. 
prepends the current log path to param fileName.
Parameters:
fileName - must not contain any path information.

toCanonicalFile

protected File toCanonicalFile(File fold)
                        throws IOException
Deprecated. 

rollover

public void rollover()
              throws IOException
Deprecated. 
convenience routine to set up the file. used when the path changes or when the file needs to be rolled over or at startup.
Specified by:
rollover in interface LogInterface

purgeOldFiles

protected void purgeOldFiles()
                      throws IOException
Deprecated. 
Look for files in excess of the maximum allowed number, and purge oldest ones.

maybeRollover

protected void maybeRollover()
                      throws IOException
Deprecated. 
Roll over if # days or size limit has been exceeded.

checkLevel

protected void checkLevel(int level,
                          boolean allowNone)
                   throws LogException
Deprecated. 
kUndefined will cause an exception. if allowNone is false, then kNone will cause an exception.

isErrorLevel

protected boolean isErrorLevel(int level)
Deprecated. 

setEcho

public void setEcho(boolean b)
Deprecated. 
Specified by:
setEcho in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Parameters:
b - 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).
See Also:
LogInterface.msg(java.lang.String)

setStackTrace

public void setStackTrace(boolean b)
Deprecated. 
Description copied from interface: LogInterface
Determines whether a logged exception will print the stack trace
Specified by:
setStackTrace in interface LogInterface

setPath

public void setPath(String path)
             throws IOException
Deprecated. 
Specified by:
setPath in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Parameters:
path - is a currently existing directory into which the log files will be written.

setPath

public void setPath(File path)
Deprecated. 

setLevel

public void setLevel(int level)
              throws LogException
Deprecated. 
Specified by:
setLevel in interface LogInterface
Parameters:
level - 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).

getLevel

public int getLevel()
Deprecated. 
Specified by:
getLevel in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Returns:
the current level as one of kNone ... kDevDebug.

setRolloverSize

public void setRolloverSize(int bytes)
Deprecated. 
Specified by:
setRolloverSize in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Parameters:
bytes - 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.

setRolloverDays

public void setRolloverDays(int days)
Deprecated. 
Specified by:
setRolloverDays in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Parameters:
days - 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.

setMaxFileCount

public void setMaxFileCount(int count)
Deprecated. 
Set maximum # of files to retain in directory. Files in excess of this number will be deleted by age.
Specified by:
setMaxFileCount in interface LogInterface
Parameters:
fileCount, - or -1 to keep all files.

setOpenFileExtension

public void setOpenFileExtension(String openFileExtension)
Deprecated. 
Sets the extension to use when log file is open. (Defaults to .txt)

setClosedFileExtension

public void setClosedFileExtension(String closedFileExtension)
Deprecated. 
Sets the extension to which log file should be renamed when file closed. Defaults to .txt. If the same as the openFileExtension, the file will not be renamed.
The purpose of renaming the file is to make it available to processes that might want to do something with the files when logging to them is complete.

setAdminNoticeAddress

public void setAdminNoticeAddress(String adr)
Deprecated. 
Specified by:
setAdminNoticeAddress in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Parameters:
adr - is an email address to direct error messages to, if that feature is enabled (by properties.txt).

setAdminNoticeLevel

public void setAdminNoticeLevel(int level)
                         throws LogException
Deprecated. 
Specified by:
setAdminNoticeLevel in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Parameters:
level - is the level at which the administrator should receive email notification. currently only allows kNone or kCritical - any higher settings will revert to kCritical.

getStackPosition

protected String getStackPosition()
Deprecated. 
this is not efficient.
Returns:
informative string consisting of the current Thread's name, and the current stack depth.

getLocalEmailAddress

public String getLocalEmailAddress()
Deprecated. 
Specified by:
getLocalEmailAddress in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Returns:
"vignette-log@localhost" where localhost is an ip address.

sendAdminNotice

protected void sendAdminNotice(int level,
                               String msg)
Deprecated. 

forceLogToStandardOut

public void forceLogToStandardOut()
Deprecated. 
Description copied from interface: LogInterface
after this call, all logging will go to go to the system output stream (console).
Specified by:
forceLogToStandardOut in interface LogInterface

redirectStdOut

public void redirectStdOut()
Deprecated. 
Description copied from interface: LogInterface
after this call, all calls to System.out will end up going to the log's PrintStream.
Specified by:
redirectStdOut in interface LogInterface

redirectStdErr

public void redirectStdErr()
Deprecated. 
Description copied from interface: LogInterface
after this call, all calls to System.err will end up going to the log's PrintStream.
Specified by:
redirectStdErr in interface LogInterface

restoreStdOut

public void restoreStdOut()
Deprecated. 
Description copied from interface: LogInterface
after this call, all calls to System.out will go to the system output stream (console).
Specified by:
restoreStdOut in interface LogInterface

restoreStdErr

public void restoreStdErr()
Deprecated. 
Description copied from interface: LogInterface
after this call, all calls to System.err will go to the system error stream (console).
Specified by:
restoreStdErr in interface LogInterface

msg

public void msg(String msg)
Deprecated. 
Log message.
Specified by:
msg in interface LogInterface

msg

public void msg(int level,
                String msg)
Deprecated. 
Log msg at given level. Nothing is logged if the level is too high (too detailed), or logging is turned off.
Specified by:
msg in interface LogInterface
Following copied from interface: com.epicentric.common.LogInterface
Parameters:
level - 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.
See Also:
LogInterface.setEcho(boolean)

msg

public void msg(int level,
                String msg,
                Throwable thrown)
Deprecated. 
Log msg at given level. If exception is nonnull, log it and the stack trace. Nothing is logged if the level is too low (too detailed), or logging is turned off.
Specified by:
msg in interface LogInterface

isStdOutRedirected

public boolean isStdOutRedirected()
Deprecated. 
Answer whether stdout is redirected to the log file.
Specified by:
isStdOutRedirected in interface LogInterface

isStdErrRedirected

public boolean isStdErrRedirected()
Deprecated. 
Answer whether stderr is redirected to the log file.
Specified by:
isStdErrRedirected in interface LogInterface

logToFile

public boolean logToFile()
Deprecated. 
Return whether logging to file is enabled.
Specified by:
logToFile in interface LogInterface

setUseDateTimeStamp

public void setUseDateTimeStamp(boolean useDateTimeStamp)
Deprecated. 
Set whether all msgs are preceded by date/time stamp.
Specified by:
setUseDateTimeStamp in interface LogInterface

usingDateTimeStamp

public boolean usingDateTimeStamp()
Deprecated. 
Return whether using dateTimeStamp
Specified by:
usingDateTimeStamp in interface LogInterface

setDateTimeStampSeparator

public void setDateTimeStampSeparator(String separator)
Deprecated. 
Set the delimiting string to be used to separate the dateTimeStamp from the text to follow.

getDateTimeStampSeparator

public String getDateTimeStampSeparator()
Deprecated. 
Return the current string used as dateTimeStamp separator. This may be useful to parsing routines.

setUseThreadName

public void setUseThreadName(boolean useThreadName)
Deprecated. 
Set whether all msgs are preceded by thread name.

usingThreadName

public boolean usingThreadName()
Deprecated. 
Return whether using threadName

setThreadNameSeparator

public void setThreadNameSeparator(String separator)
Deprecated. 
Set the delimiting string to be used to separate the threadName from the text to follow.

getThreadNameSeparator

public String getThreadNameSeparator()
Deprecated. 
Return the current string used as threadName separator. This may be useful to parsing routines.

02/28/2005
 

Copyright and Trademark Notices