Class RollingLogFile
java.lang.Object
com.netscape.cms.logging.LogFile
com.netscape.cms.logging.RollingLogFile
- All Implemented Interfaces:
IExtendedPluginInfo,ILogEventListener,EventListener
A rotating log file for Certificate log events. This class loosely follows
the Netscape Common Log API implementing rollover interval, size and file
naming conventions. It does not yet implement Disk Usage.
- Version:
- $Revision$, $Date$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic org.slf4j.Loggerprotected longThe amount of time before a backed up log is removed in millisecondsprotected intThe maximum file size in bytesprotected longThe amount of time in miniseconds between log rotationsFields inherited from class com.netscape.cms.logging.LogFile
filters, mandatoryEvents, mBufferSize, mBytesUnflushed, mBytesWritten, mConfig, mDate, mDatePattern, mFile, mFileName, mFlushInterval, mLevel, mLogDateFormat, mLogFileDateFormat, mLogSigning, mLogWriter, mOn, mRegister, mTrace, mType, PROP_LEVEL, PROP_ON, PROP_REGISTER, PROP_SIGNED_AUDIT_CERT_NICKNAME, PROP_SIGNED_AUDIT_FILTERS, PROP_SIGNED_AUDIT_LOG_SIGNING, PROP_SIGNED_AUDIT_MANDATORY_EVENTS, PROP_SIGNED_AUDIT_SELECTED_EVENTS, PROP_TRACE, PROP_TYPE, selectedEventsFields inherited from interface com.netscape.certsrv.base.IExtendedPluginInfo
HELP_TEXT, HELP_TOKEN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongexpire(long expirationSeconds) Remove any log files which have not been modified in the specified timeprotected String[]fileList()Get the log file list in the log directoryReturn list of default config parameters for this log event listener.Returns the description of this log event listener.intGet the expiration timeString[]getExtendedPluginInfo(Locale locale) This method returns an array of strings.Returns implementation name.Return list of instance config parameters for this log event listener.intGet the rollover intervalvoidinit(IConfigStore config) Initialize and open a RollingLogFile using the prop config storevoidWrite an event to the log fileretrieveLogList(Hashtable<String, String> req) Retrieve log file list.protected voidConvenience routine to initialized the RollingLogFile specific attributes.voidrotate()Rotate the log file to a backup file with timestampvoidsetExpirationTime(String expirationSeconds) Set the file expiration timevoidsetRolloverTime(String rolloverSeconds) Set the rollover intervalvoidshutdown()Shutdown this log file.voidstartup()Startup the instanceMethods inherited from class com.netscape.cms.logging.LogFile
base64Encode, close, deselectEvent, doLog, eval, eval, eval, eval, eval, eval, eval, filter, flush, getConfigStore, getLevel, getName, getOn, getType, init, init, logEvt2String, open, readEntry, replaceEvents, retrieveLogContent, selectEvent, setFlushInterval
-
Field Details
-
logger
public static org.slf4j.Logger logger -
mMaxFileSize
protected int mMaxFileSizeThe maximum file size in bytes -
mRolloverInterval
protected long mRolloverIntervalThe amount of time in miniseconds between log rotations -
mExpirationTime
protected long mExpirationTimeThe amount of time before a backed up log is removed in milliseconds
-
-
Constructor Details
-
RollingLogFile
public RollingLogFile()Construct a RollingLogFile
-
-
Method Details
-
init
Initialize and open a RollingLogFile using the prop config store- Overrides:
initin classLogFile- Parameters:
config- The property config store to find values in- Throws:
IOExceptionEBaseException
-
rl_init
-
startup
Description copied from class:LogFileStartup the instance- signed.audit LOGGING_SIGNED_AUDIT_AUDIT_LOG_STARTUP used at audit function startup
- Specified by:
startupin interfaceILogEventListener- Overrides:
startupin classLogFile- Throws:
EBaseException- if an internal error occurred
-
shutdown
public void shutdown()Shutdown this log file.- Specified by:
shutdownin interfaceILogEventListener- Overrides:
shutdownin classLogFile
-
setRolloverTime
Set the rollover interval- Parameters:
rolloverSeconds- The amount of time in seconds until the log is rotated. A value of 0 will disable log rollover.
-
getRolloverTime
public int getRolloverTime()Get the rollover interval- Returns:
- The interval in seconds in which the log is rotated
-
setExpirationTime
Set the file expiration time- Parameters:
expirationSeconds- The amount of time in seconds until log files are deleted
-
getExpirationTime
public int getExpirationTime()Get the expiration time- Returns:
- The age in seconds in which log files are delete
-
rotate
Rotate the log file to a backup file with timestamp- Throws:
IOException
-
expire
Remove any log files which have not been modified in the specified timeNOTE: automatic removal of log files is currently NOT supported!
- signed.audit LOGGING_SIGNED_AUDIT_LOG_DELETE used AFTER audit log expires (authorization should not allow, but in case authorization gets compromised make sure it is written AFTER the log expiration happens)
- Parameters:
expirationSeconds- The number of seconds since the expired files have been modified.- Returns:
- the time in milliseconds when the next file expires
- Throws:
ELogException
-
log
Write an event to the log file- Specified by:
login interfaceILogEventListener- Overrides:
login classLogFile- Parameters:
ev- The event to be logged.- Throws:
ELogException
-
retrieveLogList
public NameValuePairs retrieveLogList(Hashtable<String, String> req) throws javax.servlet.ServletException, IOException, EBaseExceptionRetrieve log file list.- Specified by:
retrieveLogListin interfaceILogEventListener- Overrides:
retrieveLogListin classLogFile- Throws:
javax.servlet.ServletExceptionIOExceptionEBaseException
-
fileList
Get the log file list in the log directory- Returns:
- an array of filenames with related path to cert server root
-
getImplName
Description copied from interface:ILogEventListenerReturns implementation name.- Specified by:
getImplNamein interfaceILogEventListener- Overrides:
getImplNamein classLogFile- Returns:
- String name of event listener implementation.
-
getDescription
Description copied from interface:ILogEventListenerReturns the description of this log event listener.- Specified by:
getDescriptionin interfaceILogEventListener- Overrides:
getDescriptionin classLogFile- Returns:
- String with listener description.
-
getDefaultParams
Description copied from interface:ILogEventListenerReturn list of default config parameters for this log event listener.- Specified by:
getDefaultParamsin interfaceILogEventListener- Overrides:
getDefaultParamsin classLogFile- Returns:
- Vector of default parameters.
-
getInstanceParams
Description copied from interface:ILogEventListenerReturn list of instance config parameters for this log event listener.- Specified by:
getInstanceParamsin interfaceILogEventListener- Overrides:
getInstanceParamsin classLogFile- Returns:
- Vector of instance parameters.
-
getExtendedPluginInfo
Description copied from interface:IExtendedPluginInfoThis method returns an array of strings. Each element of the array represents a configurable parameter, or some other meta-info (such as help-token) there is an entry indexed on that parameter name Where: type_info is either 'string', 'number', 'boolean', 'password' or 'choice(ch1,ch2,ch3,...)' If the marker 'required' is included after the type_info, the parameter will has some visually distinctive marking in the UI. 'description' is a short sentence describing the parameter 'choice' is rendered as a drop-down list. The first parameter in the list will be activated by default 'boolean' is rendered as a checkbox. The resulting parameter will be either 'true' or 'false' 'string' allows any characters 'number' allows only numbers 'password' is rendered as a password field (the characters are replaced with *'s when being types. This parameter is not passed through to the plugin. It is instead inserted directly into the password cache keyed on the instance name. The value of the parameter 'bindPWPrompt' (see example below) is set to the key. In addition to the configurable parameters, the following magic parameters may be defined: HELP_TOKEN;helptoken - a pointer to the online manual section for this plugin HELP_TEXT;helptext - a general help string describing the plugin For example: "username;string;The username you wish to login as" "bindPWPrompt;password;Enter password to bind as above user with" "algorithm;choice(RSA,DSA);Which algorithm do you want to use" "enable;boolean;Do you want to run this plugin" "port;number;Which port number do you want to use"- Specified by:
getExtendedPluginInfoin interfaceIExtendedPluginInfo- Overrides:
getExtendedPluginInfoin classLogFile
-