Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Logging library
Collaboration diagram for Logging library:

Macros

#define LOG_PRIMASK   7
 
#define APLOG_EMERG   LOG_EMERG /* system is unusable */
 
#define APLOG_ALERT   LOG_ALERT /* action must be taken immediately */
 
#define APLOG_CRIT   LOG_CRIT /* critical conditions */
 
#define APLOG_ERR   LOG_ERR /* error conditions */
 
#define APLOG_WARNING   LOG_WARNING /* warning conditions */
 
#define APLOG_NOTICE   LOG_NOTICE /* normal but significant condition */
 
#define APLOG_INFO   LOG_INFO /* informational */
 
#define APLOG_DEBUG   LOG_DEBUG /* debug-level messages */
 
#define APLOG_TRACE1   (LOG_DEBUG + 1) /* trace-level 1 messages */
 
#define APLOG_TRACE2   (LOG_DEBUG + 2) /* trace-level 2 messages */
 
#define APLOG_TRACE3   (LOG_DEBUG + 3) /* trace-level 3 messages */
 
#define APLOG_TRACE4   (LOG_DEBUG + 4) /* trace-level 4 messages */
 
#define APLOG_TRACE5   (LOG_DEBUG + 5) /* trace-level 5 messages */
 
#define APLOG_TRACE6   (LOG_DEBUG + 6) /* trace-level 6 messages */
 
#define APLOG_TRACE7   (LOG_DEBUG + 7) /* trace-level 7 messages */
 
#define APLOG_TRACE8   (LOG_DEBUG + 8) /* trace-level 8 messages */
 
#define APLOG_LEVELMASK   15 /* mask off the level value */
 
#define APLOG_NOERRNO   (APLOG_LEVELMASK + 1)
 
#define APLOG_TOCLIENT   ((APLOG_LEVELMASK + 1) * 2)
 
#define APLOG_STARTUP   ((APLOG_LEVELMASK + 1) * 4)
 
#define DEFAULT_LOGLEVEL   APLOG_WARNING
 
#define APLOGNO(n)   "AH" #n ": "
 
#define APLOG_NO_MODULE   -1
 
#define APLOG_MODULE_INDEX   (aplog_module_index ? *aplog_module_index : APLOG_NO_MODULE)
 
#define APLOG_MAX_LOGLEVEL
 
#define APLOG_MODULE_IS_LEVEL(s, module_index, level)
 
#define APLOG_CS_MODULE_IS_LEVEL(c, s, module_index, level)
 
#define APLOG_C_MODULE_IS_LEVEL(c, module_index, level)
 
#define APLOG_R_MODULE_IS_LEVEL(r, module_index, level)
 
#define APLOG_IS_LEVEL(s, level)   APLOG_MODULE_IS_LEVEL(s,APLOG_MODULE_INDEX,level)
 
#define APLOG_C_IS_LEVEL(c, level)   APLOG_C_MODULE_IS_LEVEL(c,APLOG_MODULE_INDEX,level)
 
#define APLOG_CS_IS_LEVEL(c, s, level)   APLOG_CS_MODULE_IS_LEVEL(c,s,APLOG_MODULE_INDEX,level)
 
#define APLOG_R_IS_LEVEL(r, level)   APLOG_R_MODULE_IS_LEVEL(r,APLOG_MODULE_INDEX,level)
 
#define APLOGinfo(s)   APLOG_IS_LEVEL(s,APLOG_INFO)
 
#define APLOGdebug(s)   APLOG_IS_LEVEL(s,APLOG_DEBUG)
 
#define APLOGtrace1(s)   APLOG_IS_LEVEL(s,APLOG_TRACE1)
 
#define APLOGtrace2(s)   APLOG_IS_LEVEL(s,APLOG_TRACE2)
 
#define APLOGtrace3(s)   APLOG_IS_LEVEL(s,APLOG_TRACE3)
 
#define APLOGtrace4(s)   APLOG_IS_LEVEL(s,APLOG_TRACE4)
 
#define APLOGtrace5(s)   APLOG_IS_LEVEL(s,APLOG_TRACE5)
 
#define APLOGtrace6(s)   APLOG_IS_LEVEL(s,APLOG_TRACE6)
 
#define APLOGtrace7(s)   APLOG_IS_LEVEL(s,APLOG_TRACE7)
 
#define APLOGtrace8(s)   APLOG_IS_LEVEL(s,APLOG_TRACE8)
 
#define APLOGrinfo(r)   APLOG_R_IS_LEVEL(r,APLOG_INFO)
 
#define APLOGrdebug(r)   APLOG_R_IS_LEVEL(r,APLOG_DEBUG)
 
#define APLOGrtrace1(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE1)
 
#define APLOGrtrace2(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE2)
 
#define APLOGrtrace3(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE3)
 
#define APLOGrtrace4(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE4)
 
#define APLOGrtrace5(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE5)
 
#define APLOGrtrace6(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE6)
 
#define APLOGrtrace7(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE7)
 
#define APLOGrtrace8(r)   APLOG_R_IS_LEVEL(r,APLOG_TRACE8)
 
#define APLOGcinfo(c)   APLOG_C_IS_LEVEL(c,APLOG_INFO)
 
#define APLOGcdebug(c)   APLOG_C_IS_LEVEL(c,APLOG_DEBUG)
 
#define APLOGctrace1(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE1)
 
#define APLOGctrace2(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE2)
 
#define APLOGctrace3(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE3)
 
#define APLOGctrace4(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE4)
 
#define APLOGctrace5(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE5)
 
#define APLOGctrace6(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE6)
 
#define APLOGctrace7(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE7)
 
#define APLOGctrace8(c)   APLOG_C_IS_LEVEL(c,APLOG_TRACE8)
 
#define APLOG_MARK   __FILE__,__LINE__,APLOG_MODULE_INDEX
 
#define AP_LOG_DATA_DEFAULT   0
 
#define AP_LOG_DATA_SHOW_OFFSET   1
 

Typedefs

typedef struct piped_log piped_log
 

Functions

void ap_open_stderr_log (apr_pool_t *p)
 
apr_status_t ap_replace_stderr_log (apr_pool_t *p, const char *file)
 
int ap_open_logs (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s_main)
 
void ap_logs_child_init (apr_pool_t *p, server_rec *s)
 
void ap_log_error (const char *file, int line, int module_index, int level, apr_status_t status, const server_rec *s, const char *fmt,...)
 
void ap_log_perror (const char *file, int line, int module_index, int level, apr_status_t status, apr_pool_t *p, const char *fmt,...)
 
void ap_log_rerror (const char *file, int line, int module_index, int level, apr_status_t status, const request_rec *r, const char *fmt,...)
 
void ap_log_cerror (const char *file, int line, int module_index, int level, apr_status_t status, const conn_rec *c, const char *fmt,...)
 
void ap_log_cserror (const char *file, int line, int module_index, int level, apr_status_t status, const conn_rec *c, const server_rec *s, const char *fmt,...)
 
void ap_log_data (const char *file, int line, int module_index, int level, const server_rec *s, const char *label, const void *data, apr_size_t len, unsigned int flags)
 
void ap_log_rdata (const char *file, int line, int module_index, int level, const request_rec *r, const char *label, const void *data, apr_size_t len, unsigned int flags)
 
void ap_log_cdata (const char *file, int line, int module_index, int level, const conn_rec *c, const char *label, const void *data, apr_size_t len, unsigned int flags)
 
void ap_log_csdata (const char *file, int line, int module_index, int level, const conn_rec *c, const server_rec *s, const char *label, const void *data, apr_size_t len, unsigned int flags)
 
void ap_error_log2stderr (server_rec *s)
 
void ap_log_command_line (apr_pool_t *p, server_rec *s)
 
void ap_log_mpm_common (server_rec *s)
 
void ap_log_pid (apr_pool_t *p, const char *fname)
 
void ap_remove_pid (apr_pool_t *p, const char *fname)
 
apr_status_t ap_read_pid (apr_pool_t *p, const char *filename, pid_t *mypid)
 
piped_logap_open_piped_log (apr_pool_t *p, const char *program)
 
piped_logap_open_piped_log_ex (apr_pool_t *p, const char *program, apr_cmdtype_e cmdtype)
 
void ap_close_piped_log (piped_log *pl)
 
apr_file_tap_piped_log_read_fd (piped_log *pl)
 
apr_file_tap_piped_log_write_fd (piped_log *pl)
 

Variables

AP_DECLARE_DATA int ap_default_loglevel
 

Detailed Description

Macro Definition Documentation

#define AP_LOG_DATA_DEFAULT   0

Processing flags for ap_log_data() et al

AP_LOG_DATA_DEFAULT - default formatting, with printable chars and hex AP_LOG_DATA_SHOW_OFFSET - prefix each line with hex offset from the start of the buffer

#define AP_LOG_DATA_SHOW_OFFSET   1
#define APLOG_ALERT   LOG_ALERT /* action must be taken immediately */
#define APLOG_C_IS_LEVEL (   c,
  level 
)    APLOG_C_MODULE_IS_LEVEL(c,APLOG_MODULE_INDEX,level)
#define APLOG_C_MODULE_IS_LEVEL (   c,
  module_index,
  level 
)
Value:
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
(ap_get_conn_module_loglevel(c, module_index) \
>= ((level)&APLOG_LEVELMASK) ) ) )
#define APLOG_MAX_LOGLEVEL
Definition: http_log.h:179
#define APLOG_LEVELMASK
Definition: http_log.h:60
int ap_get_conn_module_loglevel(const conn_rec *c, int index)
#define APLOG_NOTICE
Definition: http_log.h:48
#define APLOG_CRIT   LOG_CRIT /* critical conditions */
#define APLOG_CS_IS_LEVEL (   c,
  s,
  level 
)    APLOG_CS_MODULE_IS_LEVEL(c,s,APLOG_MODULE_INDEX,level)
#define APLOG_CS_MODULE_IS_LEVEL (   c,
  s,
  module_index,
  level 
)
Value:
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
(ap_get_conn_server_module_loglevel(c, s, module_index) \
>= ((level)&APLOG_LEVELMASK) ) ) )
#define APLOG_MAX_LOGLEVEL
Definition: http_log.h:179
#define APLOG_LEVELMASK
Definition: http_log.h:60
int ap_get_conn_server_module_loglevel(const conn_rec *c, const server_rec *s, int index)
#define APLOG_NOTICE
Definition: http_log.h:48
#define APLOG_DEBUG   LOG_DEBUG /* debug-level messages */
#define APLOG_EMERG   LOG_EMERG /* system is unusable */
#define APLOG_ERR   LOG_ERR /* error conditions */
#define APLOG_INFO   LOG_INFO /* informational */
#define APLOG_IS_LEVEL (   s,
  level 
)    APLOG_MODULE_IS_LEVEL(s,APLOG_MODULE_INDEX,level)
#define APLOG_LEVELMASK   15 /* mask off the level value */
#define APLOG_MARK   __FILE__,__LINE__,APLOG_MODULE_INDEX

APLOG_MARK is a convenience macro for use as the first three parameters in ap_log_error() and related functions, i.e. file, line, and module_index.

The module_index parameter was introduced in version 2.3.6. Before that version, APLOG_MARK only replaced the file and line parameters. This means that APLOG_MARK can be used with ap_log_*error in all versions of Apache httpd.

See Also
APLOG_MODULE_INDEX
ap_log_error
ap_log_cerror
ap_log_rerror
ap_log_cserror
#define APLOG_MAX_LOGLEVEL

APLOG_MAX_LOGLEVEL can be defined to remove logging above some specified level at compile time.

This requires a C99 compiler.

#define APLOG_MODULE_INDEX   (aplog_module_index ? *aplog_module_index : APLOG_NO_MODULE)

APLOG_MODULE_INDEX contains the module_index of the current module if it has been set via the APLOG_USE_MODULE or AP_DECLARE_MODULE macro. Otherwise it contains APLOG_NO_MODULE (for example in unmodified httpd 2.2 modules).

If APLOG_MARK is used in ap_log_error() and related functions, APLOG_MODULE_INDEX will be passed as module_index. In cases where APLOG_MARK cannot be used, APLOG_MODULE_INDEX should normally be passed as module_index.

See Also
APLOG_MARK
ap_log_error
#define APLOG_MODULE_IS_LEVEL (   s,
  module_index,
  level 
)
Value:
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
(s == NULL) || \
(ap_get_server_module_loglevel(s, module_index) \
>= ((level)&APLOG_LEVELMASK) ) ) )
int ap_get_server_module_loglevel(const server_rec *s, int index)
#define APLOG_MAX_LOGLEVEL
Definition: http_log.h:179
#define APLOG_LEVELMASK
Definition: http_log.h:60
#define APLOG_NOTICE
Definition: http_log.h:48
#define APLOG_NO_MODULE   -1

APLOG_NO_MODULE may be passed as module_index to ap_log_error() and related functions if the module causing the log message is not known. Normally this should not be used directly. Use APLOG_MARK or APLOG_MODULE_INDEX instead.

See Also
APLOG_MARK
APLOG_MODULE_INDEX
ap_log_error
#define APLOG_NOERRNO   (APLOG_LEVELMASK + 1)
#define APLOG_NOTICE   LOG_NOTICE /* normal but significant condition */
#define APLOG_R_IS_LEVEL (   r,
  level 
)    APLOG_R_MODULE_IS_LEVEL(r,APLOG_MODULE_INDEX,level)
#define APLOG_R_MODULE_IS_LEVEL (   r,
  module_index,
  level 
)
Value:
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
>= ((level)&APLOG_LEVELMASK) ) ) )
#define APLOG_MAX_LOGLEVEL
Definition: http_log.h:179
#define APLOG_LEVELMASK
Definition: http_log.h:60
request_rec * r
Definition: mod_dav.h:519
#define APLOG_NOTICE
Definition: http_log.h:48
int ap_get_request_module_loglevel(const request_rec *r, int index)
#define APLOG_STARTUP   ((APLOG_LEVELMASK + 1) * 4)
#define APLOG_TOCLIENT   ((APLOG_LEVELMASK + 1) * 2)

Use APLOG_TOCLIENT on ap_log_rerror() to give content handlers the option of including the error text in the ErrorDocument sent back to the client. Setting APLOG_TOCLIENT will cause the error text to be saved in the request_rec->notes table, keyed to the string "error-notes", if and only if:

  • the severity level of the message is APLOG_WARNING or greater
  • there are no other "error-notes" set in request_rec->notes Once error-notes is set, it is up to the content handler to determine whether this text should be sent back to the client. Note: Client generated text streams sent back to the client MUST be escaped to prevent CSS attacks.
#define APLOG_TRACE1   (LOG_DEBUG + 1) /* trace-level 1 messages */
#define APLOG_TRACE2   (LOG_DEBUG + 2) /* trace-level 2 messages */
#define APLOG_TRACE3   (LOG_DEBUG + 3) /* trace-level 3 messages */
#define APLOG_TRACE4   (LOG_DEBUG + 4) /* trace-level 4 messages */
#define APLOG_TRACE5   (LOG_DEBUG + 5) /* trace-level 5 messages */
#define APLOG_TRACE6   (LOG_DEBUG + 6) /* trace-level 6 messages */
#define APLOG_TRACE7   (LOG_DEBUG + 7) /* trace-level 7 messages */
#define APLOG_TRACE8   (LOG_DEBUG + 8) /* trace-level 8 messages */
#define APLOG_WARNING   LOG_WARNING /* warning conditions */
#define APLOGcdebug (   c)    APLOG_C_IS_LEVEL(c,APLOG_DEBUG)
#define APLOGcinfo (   c)    APLOG_C_IS_LEVEL(c,APLOG_INFO)
#define APLOGctrace1 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE1)
#define APLOGctrace2 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE2)
#define APLOGctrace3 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE3)
#define APLOGctrace4 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE4)
#define APLOGctrace5 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE5)
#define APLOGctrace6 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE6)
#define APLOGctrace7 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE7)
#define APLOGctrace8 (   c)    APLOG_C_IS_LEVEL(c,APLOG_TRACE8)
#define APLOGdebug (   s)    APLOG_IS_LEVEL(s,APLOG_DEBUG)
#define APLOGinfo (   s)    APLOG_IS_LEVEL(s,APLOG_INFO)
#define APLOGNO (   n)    "AH" #n ": "

APLOGNO() should be used at the start of the format string passed to ap_log_error() and friends. The argument must be a 5 digit decimal number. It creates a tag of the form "AH02182: " See docs/log-message-tags/README for details.

#define APLOGrdebug (   r)    APLOG_R_IS_LEVEL(r,APLOG_DEBUG)
#define APLOGrinfo (   r)    APLOG_R_IS_LEVEL(r,APLOG_INFO)
#define APLOGrtrace1 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE1)
#define APLOGrtrace2 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE2)
#define APLOGrtrace3 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE3)
#define APLOGrtrace4 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE4)
#define APLOGrtrace5 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE5)
#define APLOGrtrace6 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE6)
#define APLOGrtrace7 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE7)
#define APLOGrtrace8 (   r)    APLOG_R_IS_LEVEL(r,APLOG_TRACE8)
#define APLOGtrace1 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE1)
#define APLOGtrace2 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE2)
#define APLOGtrace3 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE3)
#define APLOGtrace4 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE4)
#define APLOGtrace5 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE5)
#define APLOGtrace6 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE6)
#define APLOGtrace7 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE7)
#define APLOGtrace8 (   s)    APLOG_IS_LEVEL(s,APLOG_TRACE8)
#define DEFAULT_LOGLEVEL   APLOG_WARNING
#define LOG_PRIMASK   7

Typedef Documentation

typedef struct piped_log piped_log
See Also
piped_log

Function Documentation

void ap_close_piped_log ( piped_log pl)

Close the piped log and kill the logging process

Parameters
plThe piped log structure
void ap_error_log2stderr ( server_rec s)

Convert stderr to the error log

Parameters
sThe current server
void ap_log_cdata ( const char *  file,
int  line,
int  module_index,
int  level,
const conn_rec c,
const char *  label,
const void data,
apr_size_t  len,
unsigned int  flags 
)

ap_log_cdata() - log buffers which are related to a particular connection.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
module_indexThe module_index of the module logging this buffer
levelThe log level
cThe connection which we are logging for
labelA label for the buffer, to be logged preceding the buffer
dataThe buffer to be logged
lenThe length of the buffer
flagsSpecial processing flags like AP_LOG_DATA_SHOW_OFFSET
Note
ap_log_cdata is implemented as a macro
Use APLOG_MARK to fill out file, line, and module_index
If a request_rec is available, use that with ap_log_rerror() in preference to calling this function. Otherwise, if a conn_rec is available, use that with ap_log_cerror() in preference to calling this function.
void ap_log_cerror ( const char *  file,
int  line,
int  module_index,
int  level,
apr_status_t  status,
const conn_rec c,
const char *  fmt,
  ... 
)

ap_log_cerror() - log messages which are related to a particular connection. This uses a printf-like format to log messages to the error_log.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
levelThe level of this error message
module_indexThe module_index of the module generating this message
statusThe status code from the previous command
cThe connection which we are logging for
fmtThe format string
...The arguments to use to fill out fmt.
Note
ap_log_cerror is implemented as a macro
Use APLOG_MARK to fill out file, line, and module_index
If a request_rec is available, use that with ap_log_rerror() in preference to calling this function.
Warning
It is VERY IMPORTANT that you not include any raw data from the network, such as the request-URI or request header fields, within the format string. Doing so makes the server vulnerable to a denial-of-service attack and other messy behavior. Instead, use a simple format string like "%s", followed by the string containing the untrusted data.
void ap_log_command_line ( apr_pool_t p,
server_rec s 
)

Log the command line used to start the server.

Parameters
pThe pool to use for logging
sThe server_rec whose process's command line we want to log. The command line is logged to that server's error log.
void ap_log_csdata ( const char *  file,
int  line,
int  module_index,
int  level,
const conn_rec c,
const server_rec s,
const char *  label,
const void data,
apr_size_t  len,
unsigned int  flags 
)

ap_log_csdata() - log buffers which are related to a particular connection and to a vhost other than c->base_server.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
module_indexThe module_index of the module logging this buffer
levelThe log level
cThe connection which we are logging for
sThe server which we are logging for
labelA label for the buffer, to be logged preceding the buffer
dataThe buffer to be logged
lenThe length of the buffer
flagsSpecial processing flags like AP_LOG_DATA_SHOW_OFFSET
Note
ap_log_csdata is implemented as a macro
Use APLOG_MARK to fill out file, line, and module_index
If a request_rec is available, use that with ap_log_rerror() in preference to calling this function. Otherwise, if a conn_rec is available, use that with ap_log_cerror() in preference to calling this function.
void ap_log_cserror ( const char *  file,
int  line,
int  module_index,
int  level,
apr_status_t  status,
const conn_rec c,
const server_rec s,
const char *  fmt,
  ... 
)

ap_log_cserror() - log messages which are related to a particular connection and to a vhost other than c->base_server. This uses a printf-like format to log messages to the error_log.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
levelThe level of this error message
module_indexThe module_index of the module generating this message
statusThe status code from the previous command
cThe connection which we are logging for
sThe server which we are logging for
fmtThe format string
...The arguments to use to fill out fmt.
Note
ap_log_cserror is implemented as a macro
Use APLOG_MARK to fill out file, line, and module_index
If a request_rec is available, use that with ap_log_rerror() in preference to calling this function. This function is mainly useful for modules like mod_ssl to use before the request_rec is created.
Warning
It is VERY IMPORTANT that you not include any raw data from the network, such as the request-URI or request header fields, within the format string. Doing so makes the server vulnerable to a denial-of-service attack and other messy behavior. Instead, use a simple format string like "%s", followed by the string containing the untrusted data.
void ap_log_data ( const char *  file,
int  line,
int  module_index,
int  level,
const server_rec s,
const char *  label,
const void data,
apr_size_t  len,
unsigned int  flags 
)

ap_log_data() - log buffers which are not related to a particular request or connection.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
module_indexThe module_index of the module logging this buffer
levelThe log level
sThe server on which we are logging
labelA label for the buffer, to be logged preceding the buffer
dataThe buffer to be logged
lenThe length of the buffer
flagsSpecial processing flags like AP_LOG_DATA_SHOW_OFFSET
Note
ap_log_data is implemented as a macro.
Use APLOG_MARK to fill out file, line, and module_index
If a request_rec is available, use that with ap_log_rdata() in preference to calling this function. Otherwise, if a conn_rec is available, use that with ap_log_cdata() in preference to calling this function.
void ap_log_error ( const char *  file,
int  line,
int  module_index,
int  level,
apr_status_t  status,
const server_rec s,
const char *  fmt,
  ... 
)

ap_log_error() - log messages which are not related to a particular request or connection. This uses a printf-like format to log messages to the error_log.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
module_indexThe module_index of the module generating this message
levelThe level of this error message
statusThe status code from the previous command
sThe server on which we are logging
fmtThe format string
...The arguments to use to fill out fmt.
Note
ap_log_error is implemented as a macro
Use APLOG_MARK to fill out file and line
If a request_rec is available, use that with ap_log_rerror() in preference to calling this function. Otherwise, if a conn_rec is available, use that with ap_log_cerror() in preference to calling this function.
Warning
It is VERY IMPORTANT that you not include any raw data from the network, such as the request-URI or request header fields, within the format string. Doing so makes the server vulnerable to a denial-of-service attack and other messy behavior. Instead, use a simple format string like "%s", followed by the string containing the untrusted data.
void ap_log_mpm_common ( server_rec s)

Log common (various) MPM shared data at startup.

Parameters
sThe server_rec of the error log we want to log to. Misc commonly logged data is logged to that server's error log.
void ap_log_perror ( const char *  file,
int  line,
int  module_index,
int  level,
apr_status_t  status,
apr_pool_t p,
const char *  fmt,
  ... 
)

ap_log_perror() - log messages which are not related to a particular request, connection, or virtual server. This uses a printf-like format to log messages to the error_log.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
module_indexignored dummy value for use by APLOG_MARK
levelThe level of this error message
statusThe status code from the previous command
pThe pool which we are logging for
fmtThe format string
...The arguments to use to fill out fmt.
Note
ap_log_perror is implemented as a macro
Use APLOG_MARK to fill out file, line, and module_index
Warning
It is VERY IMPORTANT that you not include any raw data from the network, such as the request-URI or request header fields, within the format string. Doing so makes the server vulnerable to a denial-of-service attack and other messy behavior. Instead, use a simple format string like "%s", followed by the string containing the untrusted data.
void ap_log_pid ( apr_pool_t p,
const char *  fname 
)

Log the current pid of the parent process

Parameters
pThe pool to use for processing
fnameThe name of the file to log to. If the filename is not absolute then it is assumed to be relative to DefaultRuntimeDir.
void ap_log_rdata ( const char *  file,
int  line,
int  module_index,
int  level,
const request_rec r,
const char *  label,
const void data,
apr_size_t  len,
unsigned int  flags 
)

ap_log_rdata() - log buffers which are related to a particular request.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
module_indexThe module_index of the module logging this buffer
levelThe log level
rThe request which we are logging for
labelA label for the buffer, to be logged preceding the buffer
dataThe buffer to be logged
lenThe length of the buffer
flagsSpecial processing flags like AP_LOG_DATA_SHOW_OFFSET
Note
ap_log_rdata is implemented as a macro.
Use APLOG_MARK to fill out file, line, and module_index
If a request_rec is available, use that with ap_log_rerror() in preference to calling this function. Otherwise, if a conn_rec is available, use that with ap_log_cerror() in preference to calling this function.
void ap_log_rerror ( const char *  file,
int  line,
int  module_index,
int  level,
apr_status_t  status,
const request_rec r,
const char *  fmt,
  ... 
)

ap_log_rerror() - log messages which are related to a particular request. This uses a printf-like format to log messages to the error_log.

Parameters
fileThe file in which this function is called
lineThe line number on which this function is called
module_indexThe module_index of the module generating this message
levelThe level of this error message
statusThe status code from the previous command
rThe request which we are logging for
fmtThe format string
...The arguments to use to fill out fmt.
Note
ap_log_rerror is implemented as a macro
Use APLOG_MARK to fill out file, line, and module_index
Warning
It is VERY IMPORTANT that you not include any raw data from the network, such as the request-URI or request header fields, within the format string. Doing so makes the server vulnerable to a denial-of-service attack and other messy behavior. Instead, use a simple format string like "%s", followed by the string containing the untrusted data.
void ap_logs_child_init ( apr_pool_t p,
server_rec s 
)

Perform special processing for piped loggers in MPM child processes.

Parameters
pNot used
sNot used
Note
ap_logs_child_init is not for use by modules; it is an internal core function
int ap_open_logs ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptemp,
server_rec s_main 
)

Open the error log and replace stderr with it.

Parameters
pconfNot used
plogThe pool to allocate the logs from
ptempPool used for temporary allocations
s_mainThe main server
Note
ap_open_logs isn't expected to be used by modules, it is an internal core function
piped_log* ap_open_piped_log ( apr_pool_t p,
const char *  program 
)

Open the piped log process

Parameters
pThe pool to allocate out of
programThe program to run in the logging process
Returns
The piped log structure
Note
The log program is invoked as APR_PROGRAM_ENV,
See Also
ap_open_piped_log_ex to modify this behavior
piped_log* ap_open_piped_log_ex ( apr_pool_t p,
const char *  program,
apr_cmdtype_e  cmdtype 
)

Open the piped log process specifying the execution choice for program

Parameters
pThe pool to allocate out of
programThe program to run in the logging process
cmdtypeHow to invoke program, e.g. APR_PROGRAM, APR_SHELLCMD_ENV, etc
Returns
The piped log structure
void ap_open_stderr_log ( apr_pool_t p)

Set up for logging to stderr.

Parameters
pThe pool to allocate out of
apr_file_t* ap_piped_log_read_fd ( piped_log pl)

A function to return the read side of the piped log pipe

Parameters
plThe piped log structure
Returns
The native file descriptor
apr_file_t* ap_piped_log_write_fd ( piped_log pl)

A function to return the write side of the piped log pipe

Parameters
plThe piped log structure
Returns
The native file descriptor
apr_status_t ap_read_pid ( apr_pool_t p,
const char *  filename,
pid_t *  mypid 
)

Retrieve the pid from a pidfile.

Parameters
pThe pool to use for processing
filenameThe name of the file containing the pid. If the filename is not absolute then it is assumed to be relative to DefaultRuntimeDir.
mypidPointer to pid_t (valid only if return APR_SUCCESS)
void ap_remove_pid ( apr_pool_t p,
const char *  fname 
)

Remove the pidfile.

Parameters
pThe pool to use for processing
fnameThe name of the pid file to remove. If the filename is not absolute then it is assumed to be relative to DefaultRuntimeDir.
apr_status_t ap_replace_stderr_log ( apr_pool_t p,
const char *  file 
)

Replace logging to stderr with logging to the given file.

Parameters
pThe pool to allocate out of
fileName of the file to log stderr output

Variable Documentation

AP_DECLARE_DATA int ap_default_loglevel