SUMMARY: CONSTR | METHOD DETAIL: CONSTR | METHOD

Class HTTP::Daemon::Threaded::Logger

Inherits from:
Thread::Apartment::Server

Interface specification for an apartment threaded Logger component. Opens the logfile. Accepts log messages, prefixes them with timestamps, and writes them to the logfile. Also inspects the size and lifetime of the current logfile at regular intervals; when either size or lifetime exceeds the defined maximums (or at the direction of an external control command), closes and renames the current logfile, and then opens a new logfile.

Classes which use a Logger object should inherit the HTTP::Daemon::Threaded::Logable class. While this class provides a default implementation, applications should implement their own subclasses, and create instances to be passed to HTTP::Daemon::Threaded as either the EventLogger and/or WebLogger parameters.

Copyright© 2006, Dean Arnold, Presicient Corp., USA
All rights reserved.

Licensed under the Academic Free License version 2.1, as specified in the License.txt file included in this software package, or at OpenSource.org.

Author:
D. Arnold
Version:
0.90
Since:
2005-08-21

Unless otherwise noted, $self is the object instance variable.

Constructor Summary
new(AptTimeout => value, Path => value, MaxSize => value, Lifetime => value)
          Opens the logfile

Method Summary
close()
          Close the logfile
get_simplex_methods()
          Overrides Thread::Apartment::Server::get_simplex_methods()
log($msg)
          Append a log message to the logfile
truncate($newpath)
          Truncate the logfile
updateLifetime($lifetime)
          Update logfile lifetime
updateMaxSize($maxsize)
          Update logfile maximum size
updatePath($path)
          Update logfile name

Constructor Details

new

new(AptTimeout => value, Path => value, MaxSize => value, Lifetime => value)

Opens the logfile. If the logfile is too old or big, it is truncated (i.e., closed, and renamed with the current timestamp as its suffix, and a new file is created). An initial startup log message is written.

Parameters:
AptTimeout => maximum Thread::Apartment proxy method call timeout
Path => pathname of logfile
MaxSize => maximum size of logfile, in megabytes
Lifetime => maximum lifetime of logfile, in hours
Returns:
HTTP::Daemon::Threaded::Logger object

Method Details

close

close()

Close the logfile.

Simplex
Returns:
none

get_simplex_methods

get_simplex_methods()

Overrides Thread::Apartment::Server::get_simplex_methods()

Returns:
hashref of simplex method names

log

log($msg)

Append a log message to the logfile. The current timestamp is prepended to the message before it is logged.

Simplex
Parameters:
$msg - log message text
Returns:
none

truncate

truncate($newpath)

Truncate the logfile. Close the current file, rename it with the current timestamp appended to its name, and create a new logfile. Writes an introductory message to the log.

Simplex
Parameters:
$newpath - optional new logfile path
Returns:
none

updateLifetime

updateLifetime($lifetime)

Update logfile lifetime. Called from WebClient.

Simplex
Parameters:
$lifetime - lifetime in hours.
Returns:
none

updateMaxSize

updateMaxSize($maxsize)

Update logfile maximum size. Called from WebClient.

Simplex
Parameters:
$maxsize - Maximum size in megabytes.
Returns:
none

updatePath

updatePath($path)

Update logfile name. Called from WebClient. Truncates the existing logfile.

Simplex
Parameters:
$path - new logfile name
Returns:
none

Generated by psichedoc on Mon Aug 28 09:45:39 2006