Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Logging_Strategy Class Reference

This class provides the hooks to control the output produced by any of the network services. More...

`#include <Logging_Strategy.h>`

Inheritance diagram for ACE_Logging_Strategy

[legend]
Collaboration diagram for ACE_Logging_Strategy:

[legend]
List of all members.

## Public Methods
| ACE_Logging_Strategy (void)
| Constructor.
virtual int | init (int argc, ACE_TCHAR *argv[])
| Dynamic linking initialization hook.
virtual int | fini (void)
| Dynamic linking termination hook.
virtual int | handle_timeout (const ACE_Time_Value& tv, const void* arg)
int | parse_args (int argc, ACE_TCHAR *argv[])
void | log_msg (ACE_Log_Msg *log_msg)
## Private Methods
void | tokenize (ACE_TCHAR *flag_string)
| Tokenize to set all the flags.
void | priorities (ACE_TCHAR *priority_string, ACE_Log_Msg::MASK_TYPE mask)
| Tokenize to set priorities (either process or thread one).
## Private Attributes
u_long | thread_priority_mask_
| Current thread's priority mask set by <priorities>.
u_long | process_priority_mask_
| Process-wide priority mask set by <priorities>.
u_long | flags_
| Flags we keep track of.
ACE_TCHAR* | filename_
| File name we're logging to.
ACE_TCHAR* | logger_key_
| Logger key for distributed logging.
ACE_TCHAR* | program_name_
| Program name to be used for n format specifier.
int | wipeout_logfile_
| If non-0 then wipeout the logfile, otherwise append to it. Default value is 0.
int | count_
| This tells us in what file we last wrote. It will be increased to enable multiple log files.
int | fixed_number_
| If non-0 we have a maximum number of log files we can write. Default value is 0, i.e., no maximum number.
int | order_files_
| If non-0 we order the files as we rotate them. Default value is 0, i.e., we do not rotate files by default.
int | max_file_number_
| Tells us what is the maximum log file to write. We will write <max_file_number_> + 1 files (includes the current log file). Default value is 1, i.e., 2 files by default.
u_long | interval_
| If non-zero, sampling interval (in secs) at which maximum logfile size is checked, otherwise logfile size can grow indefinitely. Default value is 0.
u_long | max_size_
| Maximum logfile size (in KB). Default value is .
ACE_Log_Msg* | log_msg_
| ACE_Log_Msg instance to work with.

## Detailed Description

This class provides the hooks to control the output produced by any of the network services.

Depending upon when this service is invoked and with what flags, the output of other network services can be controlled. The output can be streamed to stderr, to a file, to a logging daemon, or it can be set to be "silent". If logging records are output to a file, the file can be set to a maximum size and repeatedly split into new files. The log file size can be limited at any logging point (i.e., application, client logging daemon, or server logging daemon) by specifying the -i <sample_interval_in_secs> and -m <max_size_in_KB> options for the Logging_Strategy class in a svc.conf file.

By default, two logfiles are generated. It's possible, however, to generate as many logfiles as necessary to store all the information. To achieve this, it is only necessary to indicate the maximum size of the logfiles via the -m option and the process will generate automatically the logfiles. You can control the total number of logfiles created via the -n option.

By using the -o option we can also choose the mode of organization of the files, e.g., the first one is the normal used in Unix systems (when cron rotates the logs it keeps the lowest number the most recent one), the second is for increasing speed (we only create a new log file, and don't rotate the others (fewer accesses to disk)).

## Constructor & Destructor Documentation

ACE_Logging_Strategy::ACE_Logging_Strategy ( | void )

| Constructor.

## Member Function Documentation

int ACE_Logging_Strategy::fini ( | void )`[virtual]`

| Dynamic linking termination hook. Reimplemented from ACE_Shared_Object.

int ACE_Logging_Strategy::handle_timeout ( | const ACE_Time_Value & tv,
| const void * arg )`[virtual]`

| Timeout handler which tests logfile size. If the current logfile size exceeds <max_size_>, the current logfile is closed, saved to logfile.old, and a new logfile is reopened. Reimplemented from ACE_Event_Handler.

int ACE_Logging_Strategy::init ( | int argc,
| ACE_TCHAR * argv[] )`[virtual]`

| Dynamic linking initialization hook. Reimplemented from ACE_Shared_Object.

void ACE_Logging_Strategy::log_msg ( | ACE_Log_Msg * log_msg )

int ACE_Logging_Strategy::parse_args ( | int argc,
| ACE_TCHAR * argv[] )

| Parse arguments provided in svc.conf file. '-f' Pass in the flags (such as OSTREAM, STDERR, LOGGER, VERBOSE, SILENT, VERBOSE_LITE) used to control logging. '-i' The interval (in seconds) at which the logfile size is sampled (default is 0, i.e., do not sample by default). '-k' Set the logging key. '-m' Maximum logfile size in Kbytes. '-n' Set the program name for the n format specifier. '-N' The maximum number of logfiles that we want created. '-o' Specifies that we want the no standard logfiles ordering (fastest processing in <handle_timeout>). Default is not to order logfiles. '-p' Pass in the process-wide priorities to either enable (e.g., DEBUG, INFO, WARNING, NOTICE, ERROR, CRITICAL, ALERT, EMERGENCY) or to disable (e.g., ~DEBUG, ~INFO, ~WARNING, ~NOTICE, ~ERROR, ~CRITICAL, ~ALERT, ~EMERGENCY). '-s' Ensure that the OSTREAM flag is set '-t' Pass in the thread-wide priorities to either enable (e.g., DEBUG, INFO, WARNING, NOTICE, ERROR, CRITICAL, ALERT, EMERGENCY) or to disable (e.g., ~DEBUG, ~INFO, ~WARNING, ~NOTICE, ~ERROR, ~CRITICAL, ~ALERT, ~EMERGENCY). '-w' Cause the logfile to be wiped out, both on startup and on reconfiguration.

void ACE_Logging_Strategy::priorities ( | ACE_TCHAR * priority_string,
| ACE_Log_Msg::MASK_TYPE mask )`[inline, private]`

| Tokenize to set priorities (either process or thread one).

void ACE_Logging_Strategy::tokenize ( | ACE_TCHAR * flag_string )`[private]`

| Tokenize to set all the flags.

## Member Data Documentation

int ACE_Logging_Strategy::count_`[private]`

| This tells us in what file we last wrote. It will be increased to enable multiple log files.

ACE_TCHAR * ACE_Logging_Strategy::filename_`[private]`

| File name we're logging to.

int ACE_Logging_Strategy::fixed_number_`[private]`

| If non-0 we have a maximum number of log files we can write. Default value is 0, i.e., no maximum number.

u_long ACE_Logging_Strategy::flags_`[private]`

| Flags we keep track of.

u_long ACE_Logging_Strategy::interval_`[private]`

| If non-zero, sampling interval (in secs) at which maximum logfile size is checked, otherwise logfile size can grow indefinitely. Default value is 0.

ACE_Log_Msg * ACE_Logging_Strategy::log_msg_`[private]`

| ACE_Log_Msg instance to work with.

ACE_TCHAR * ACE_Logging_Strategy::logger_key_`[private]`

| Logger key for distributed logging.

int ACE_Logging_Strategy::max_file_number_`[private]`

| Tells us what is the maximum log file to write. We will write <max_file_number_> + 1 files (includes the current log file). Default value is 1, i.e., 2 files by default.

u_long ACE_Logging_Strategy::max_size_`[private]`

| Maximum logfile size (in KB). Default value is .

int ACE_Logging_Strategy::order_files_`[private]`

| If non-0 we order the files as we rotate them. Default value is 0, i.e., we do not rotate files by default.

u_long ACE_Logging_Strategy::process_priority_mask_`[private]`

| Process-wide priority mask set by <priorities>.

ACE_TCHAR * ACE_Logging_Strategy::program_name_`[private]`

| Program name to be used for n format specifier.

u_long ACE_Logging_Strategy::thread_priority_mask_`[private]`

| Current thread's priority mask set by <priorities>.

int ACE_Logging_Strategy::wipeout_logfile_`[private]`

| If non-0 then wipeout the logfile, otherwise append to it. Default value is 0.

The documentation for this class was generated from the following files:

- Logging_Strategy.h
- Logging_Strategy.cpp