Poster of Linux kernelThe best gift for a Linux geek
appender_type_rollingfile.h

appender_type_rollingfile.h

Section: log4c (3) Updated: 10 May 2008
Local index Up
 

NAME

appender_type_rollingfile.h - Log4c rolling file appender interface.  

SYNOPSIS


#include <log4c/defs.h>
#include <log4c/appender.h>
#include <log4c/rollingpolicy.h>

 

Functions


LOG4C_API rollingfile_udata_t * rollingfile_make_udata (void)

LOG4C_API int rollingfile_udata_set_logdir (rollingfile_udata_t *rfudatap, char *logdir)

LOG4C_API int rollingfile_udata_set_files_prefix (rollingfile_udata_t *rfudatap, char *prefix)

LOG4C_API int rollingfile_udata_set_policy (rollingfile_udata_t *rfudatap, log4c_rollingpolicy_t *policyp)

LOG4C_API const char * rollingfile_udata_get_logdir (rollingfile_udata_t *rfudatap)

LOG4C_API const char * rollingfile_udata_get_files_prefix (rollingfile_udata_t *rfudatap)

LOG4C_API long rollingfile_get_current_file_size (rollingfile_udata_t *rfudatap)
 

Variables


__LOG4C_BEGIN_DECLS LOG4C_API const log4c_appender_type_t log4c_appender_type_rollingfile
 

Detailed Description

Log4c rolling file appender interface.

The rolling file appender implements a logging mechanism of a list of files up to a maximum number.

The files are written by default to the current directory with logging names folowing the pattern log.1, log.2 etc. These parameters may be changed using the appropriate setter functions.

If the appender fails to open logfiles for writing then the messages are logged to stderr--it will continue to try to open the zero-th file for writing at rollover events so if it succeeds at some point to open that file the messages will start to appear therein and will no longer be sent to stderr.

Switching from logging from one file to the next is referred to as a 'rollover event'.

The policy that determines when a rollover event should happen is called a 'rolling policy'.

A mechanism is provided to allow different rolling policies to be defined.

Log4c ships with (and defaults to) the classic size-window rollover policy: this triggers rollover when files reach a maximum size. The first file in the list is always the current file; when a rollover event occurs files are shifted up by one position in the list--if the number of files in the list has already reached the max then the oldest file is rotated out of the window.

See the documentation in the rollingpolicy_type_sizewin.h file for more details on the size-win rollover policy.  

Function Documentation

 

LOG4C_API long rollingfile_get_current_file_size (rollingfile_udata_t * rfudatap)

Get the prefix string in this rolling file appender configuration.

Parameters:

rfudatap the rolling file appender configuration object.

Returns:

the current size of the file being logged to.

 

LOG4C_API rollingfile_udata_t* rollingfile_make_udata (void)

Get a new rolling file appender configuration object.

Returns:

a new rolling file appender configuration object, otherwise NULL.

 

LOG4C_API const char* rollingfile_udata_get_files_prefix (rollingfile_udata_t * rfudatap)

Get the prefix string in this rolling file appender configuration.

Parameters:

rfudatap the rolling file appender configuration object.

Returns:

the prefix.

 

LOG4C_API const char* rollingfile_udata_get_logdir (rollingfile_udata_t * rfudatap)

Get the logging directory in this rolling file appender configuration.

Parameters:

rfudatap the rolling file appender configuration object.

Returns:

the logging directory.

 

LOG4C_API int rollingfile_udata_set_files_prefix (rollingfile_udata_t * rfudatap, char * prefix)

Set the prefix string in this rolling file appender configuration.

Parameters:

rfudatap the rolling file appender configuration object.
prefix the logging files prfix to use.

Returns:

zero if successful, non-zero otherwise.

 

LOG4C_API int rollingfile_udata_set_logdir (rollingfile_udata_t * rfudatap, char * logdir)

Set the logging directory in this rolling file appender configuration.

Parameters:

rfudatap the rolling file appender configuration object.
logdir the logging directory to set.

Returns:

zero if successful, non-zero otherwise.

 

LOG4C_API int rollingfile_udata_set_policy (rollingfile_udata_t * rfudatap, log4c_rollingpolicy_t * policyp)

Set the rolling policy in this rolling file appender configuration.

Parameters:

rfudatap the rolling file appender configuration object.
policyp the logging files prfix to use.

Returns:

zero if successful, non-zero otherwise.

 

Variable Documentation

 

__LOG4C_BEGIN_DECLS LOG4C_API const log4c_appender_type_t log4c_appender_type_rollingfile

rollingfile appender type definition.

This should be used as a parameter to the log4c_appender_set_type() routine to set the type of the appender.  

Author

Generated automatically by Doxygen for log4c from the source code.


 

Index

NAME
SYNOPSIS
Functions
Variables
Detailed Description
Function Documentation
LOG4C_API long rollingfile_get_current_file_size (rollingfile_udata_t * rfudatap)
LOG4C_API rollingfile_udata_t* rollingfile_make_udata (void)
LOG4C_API const char* rollingfile_udata_get_files_prefix (rollingfile_udata_t * rfudatap)
LOG4C_API const char* rollingfile_udata_get_logdir (rollingfile_udata_t * rfudatap)
LOG4C_API int rollingfile_udata_set_files_prefix (rollingfile_udata_t * rfudatap, char * prefix)
LOG4C_API int rollingfile_udata_set_logdir (rollingfile_udata_t * rfudatap, char * logdir)
LOG4C_API int rollingfile_udata_set_policy (rollingfile_udata_t * rfudatap, log4c_rollingpolicy_t * policyp)
Variable Documentation
__LOG4C_BEGIN_DECLS LOG4C_API const log4c_appender_type_t log4c_appender_type_rollingfile
Author

This document was created by man2html, using the manual pages.
Time: 21:49:39 GMT, April 16, 2011