Class TFileLogRoute
TFileLogRoute class.
TFileLogRoute records log messages in files. The log files are stored under LogPath and the file name is specified by LogFile. If the size of the log file is greater than MaxFileSize (in kilo-bytes), a rotation is performed, which renames the current log file by suffixing the file name with '.1'. All existing log files are moved backwards one place, i.e., '.2' to '.3', '.1' to '.2'. The property MaxLogFiles specifies how many files to be kept.
Method Summary |
string
|
|
string
|
|
integer
|
|
integer
|
|
protected
void
|
Saves log messages in files.
|
protected
void
|
Rotates log files.
|
void
|
|
void
|
|
void
|
|
void
|
|
Methods Inherited From TComponent |
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()
|
Method Details |
getLogFile
public string getLogFile |
() |
Output |
string
| log file name. Defaults to 'prado.log'. |
Exception |
|
getLogPath
public string getLogPath |
() |
Output |
string
| directory storing log files. Defaults to application runtime path. |
Exception |
|
getMaxFileSize
public integer getMaxFileSize |
() |
Output |
integer
| maximum log file size in kilo-bytes (KB). Defaults to 1024 (1MB). |
Exception |
|
getMaxLogFiles
public integer getMaxLogFiles |
() |
Output |
integer
| number of files used for rotation. Defaults to 2. |
Exception |
|
processLogs
protected void processLogs |
(array $logs ) |
Saves log messages in files.
Input |
array | $logs | list of log messages |
Output |
Exception |
|
rotateFiles
protected void rotateFiles |
() |
Rotates log files.
|
setLogFile
public void setLogFile |
(string $value ) |
Input |
string | $value | log file name |
Output |
Exception |
|
setLogPath
public void setLogPath |
(string $value ) |
Input |
string | $value | directory (in namespace format) storing log files. |
Output |
Exception |
throws | TConfigurationException if log path is invalid |
|
setMaxFileSize
public void setMaxFileSize |
(integer $value ) |
Input |
integer | $value | maximum log file size in kilo-bytes (KB). |
Output |
Exception |
throws | TInvalidDataValueException if the value is smaller than 1. |
|
setMaxLogFiles
public void setMaxLogFiles |
(integer $value ) |
Input |
integer | $value | number of files used for rotation. |
Output |
Exception |
|
|