MprLogToFile Class Reference

#include <mpr.h>

Inheritance diagram for MprLogToFile:

MprLogListener MprLink List of all members.

Detailed Description

Log MPR messages to a file.

MprLogToFile is the default listener for log messages in the MPR. It will log trace at the desired level and automatically rotate log files when full. The log file specification passed to setLogSpec() contains the:

  • log path name
  • modules to log
  • maximum log file size before rotation
  • desired trace level
The log specification is:
        fileName[[,moduleName]...][:level][.maxSize]

Module names (if specified) are internal MPR names such as socket. This allows you to log trace from only designated modules. The level must be between 0 and 9 with 9 being the most verbose. A good normal level is 2. The maxSize specification is the size of the logfile in MB before rotating. When rotated, the old file will have a ".old" appended.


Public Member Functions

 MprLogToFile ()
 ~MprLogToFile ()
void logEvent (char *module, int flags, int level, char *thread, char *msg)
int start ()
void insertAfter (MprLink *item)
void insertPrior (MprLink *item)

Constructor & Destructor Documentation

MprLogToFile::MprLogToFile  ) 
 

Constructor.

MprLogToFile::~MprLogToFile  ) 
 

Destructor.


Member Function Documentation

void MprLink::insertAfter MprLink item  )  [inline, inherited]
 

Insert after this member.

void MprLink::insertPrior MprLink item  )  [inline, inherited]
 

Insert prior to this member.

void MprLogToFile::logEvent char *  module,
int  flags,
int  level,
char *  thread,
char *  msg
[virtual]
 

Synopsis:
Virtual callback to receive a log event message.
Overview:
Listeners must override the logEvent method which will be called whenever a log message is being written.
Parameters:
module Name of the module issuing the event
flags Log flags
level Verbosity level (0-9)
thread Name of the invoking thread
msg Message text
Stability Classification:
Evolving.
Library:
libappWeb
See also:
MprLogListener::, Mpr::addListener, mprError, mprLog

Reimplemented from MprLogListener.

int MprLogToFile::start  )  [virtual]
 

Synopsis:
Called when logging commences.
Overview:
The start method will be invoked by the MPR when logging commences.
Stability Classification:
Evolving.
Library:
libappWeb
See also:
MprLogListener, Mpr::addListener, mprError, mprLog

Reimplemented from MprLogListener.

© Mbedthis Software LLC, 2003-2004. All rights reserved. Mbedthis is a trademark of Mbedthis Software LLC.