Blame include/http_log.h

Packit 90a5c9
/* Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
 * contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
 * this work for additional information regarding copyright ownership.
Packit 90a5c9
 * The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
 * (the "License"); you may not use this file except in compliance with
Packit 90a5c9
 * the License.  You may obtain a copy of the License at
Packit 90a5c9
 *
Packit 90a5c9
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
 *
Packit 90a5c9
 * Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
 * See the License for the specific language governing permissions and
Packit 90a5c9
 * limitations under the License.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * @file  http_log.h
Packit 90a5c9
 * @brief Apache Logging library
Packit 90a5c9
 *
Packit 90a5c9
 * @defgroup APACHE_CORE_LOG Logging library
Packit 90a5c9
 * @ingroup  APACHE_CORE
Packit 90a5c9
 * @{
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifndef APACHE_HTTP_LOG_H
Packit 90a5c9
#define APACHE_HTTP_LOG_H
Packit 90a5c9
Packit 90a5c9
#ifdef __cplusplus
Packit 90a5c9
extern "C" {
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#include "apr_thread_proc.h"
Packit 90a5c9
#include "http_config.h"
Packit 90a5c9
Packit 90a5c9
#ifdef HAVE_SYSLOG
Packit 90a5c9
#include <syslog.h>
Packit 90a5c9
Packit 90a5c9
#ifndef LOG_PRIMASK
Packit 90a5c9
#define LOG_PRIMASK 7
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#define APLOG_EMERG     LOG_EMERG       /* system is unusable */
Packit 90a5c9
#define APLOG_ALERT     LOG_ALERT       /* action must be taken immediately */
Packit 90a5c9
#define APLOG_CRIT      LOG_CRIT        /* critical conditions */
Packit 90a5c9
#define APLOG_ERR       LOG_ERR         /* error conditions */
Packit 90a5c9
#define APLOG_WARNING   LOG_WARNING     /* warning conditions */
Packit 90a5c9
#define APLOG_NOTICE    LOG_NOTICE      /* normal but significant condition */
Packit 90a5c9
#define APLOG_INFO      LOG_INFO        /* informational */
Packit 90a5c9
#define APLOG_DEBUG     LOG_DEBUG       /* debug-level messages */
Packit 90a5c9
#define APLOG_TRACE1   (LOG_DEBUG + 1)  /* trace-level 1 messages */
Packit 90a5c9
#define APLOG_TRACE2   (LOG_DEBUG + 2)  /* trace-level 2 messages */
Packit 90a5c9
#define APLOG_TRACE3   (LOG_DEBUG + 3)  /* trace-level 3 messages */
Packit 90a5c9
#define APLOG_TRACE4   (LOG_DEBUG + 4)  /* trace-level 4 messages */
Packit 90a5c9
#define APLOG_TRACE5   (LOG_DEBUG + 5)  /* trace-level 5 messages */
Packit 90a5c9
#define APLOG_TRACE6   (LOG_DEBUG + 6)  /* trace-level 6 messages */
Packit 90a5c9
#define APLOG_TRACE7   (LOG_DEBUG + 7)  /* trace-level 7 messages */
Packit 90a5c9
#define APLOG_TRACE8   (LOG_DEBUG + 8)  /* trace-level 8 messages */
Packit 90a5c9
Packit 90a5c9
#define APLOG_LEVELMASK 15     /* mask off the level value */
Packit 90a5c9
Packit 90a5c9
#else
Packit 90a5c9
Packit 90a5c9
#define APLOG_EMERG      0     /* system is unusable */
Packit 90a5c9
#define APLOG_ALERT      1     /* action must be taken immediately */
Packit 90a5c9
#define APLOG_CRIT       2     /* critical conditions */
Packit 90a5c9
#define APLOG_ERR        3     /* error conditions */
Packit 90a5c9
#define APLOG_WARNING    4     /* warning conditions */
Packit 90a5c9
#define APLOG_NOTICE     5     /* normal but significant condition */
Packit 90a5c9
#define APLOG_INFO       6     /* informational */
Packit 90a5c9
#define APLOG_DEBUG      7     /* debug-level messages */
Packit 90a5c9
#define APLOG_TRACE1     8     /* trace-level 1 messages */
Packit 90a5c9
#define APLOG_TRACE2     9     /* trace-level 2 messages */
Packit 90a5c9
#define APLOG_TRACE3    10     /* trace-level 3 messages */
Packit 90a5c9
#define APLOG_TRACE4    11     /* trace-level 4 messages */
Packit 90a5c9
#define APLOG_TRACE5    12     /* trace-level 5 messages */
Packit 90a5c9
#define APLOG_TRACE6    13     /* trace-level 6 messages */
Packit 90a5c9
#define APLOG_TRACE7    14     /* trace-level 7 messages */
Packit 90a5c9
#define APLOG_TRACE8    15     /* trace-level 8 messages */
Packit 90a5c9
Packit 90a5c9
#define APLOG_LEVELMASK 15     /* mask off the level value */
Packit 90a5c9
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/* APLOG_NOERRNO is ignored and should not be used.  It will be
Packit 90a5c9
 * removed in a future release of Apache.
Packit 90a5c9
 */
Packit 90a5c9
#define APLOG_NOERRNO           (APLOG_LEVELMASK + 1)
Packit 90a5c9
Packit 90a5c9
/** Use APLOG_TOCLIENT on ap_log_rerror() to give content
Packit 90a5c9
 * handlers the option of including the error text in the
Packit 90a5c9
 * ErrorDocument sent back to the client. Setting APLOG_TOCLIENT
Packit 90a5c9
 * will cause the error text to be saved in the request_rec->notes
Packit 90a5c9
 * table, keyed to the string "error-notes", if and only if:
Packit 90a5c9
 * - the severity level of the message is APLOG_WARNING or greater
Packit 90a5c9
 * - there are no other "error-notes" set in request_rec->notes
Packit 90a5c9
 * Once error-notes is set, it is up to the content handler to
Packit 90a5c9
 * determine whether this text should be sent back to the client.
Packit 90a5c9
 * Note: Client generated text streams sent back to the client MUST
Packit 90a5c9
 * be escaped to prevent CSS attacks.
Packit 90a5c9
 */
Packit 90a5c9
#define APLOG_TOCLIENT          ((APLOG_LEVELMASK + 1) * 2)
Packit 90a5c9
Packit 90a5c9
/* normal but significant condition on startup, usually printed to stderr */
Packit 90a5c9
#define APLOG_STARTUP           ((APLOG_LEVELMASK + 1) * 4)
Packit 90a5c9
Packit 90a5c9
#ifndef DEFAULT_LOGLEVEL
Packit 90a5c9
#define DEFAULT_LOGLEVEL        APLOG_WARNING
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * APLOGNO() should be used at the start of the format string passed
Packit 90a5c9
 * to ap_log_error() and friends. The argument must be a 5 digit decimal
Packit 90a5c9
 * number. It creates a tag of the form "AH02182: "
Packit 90a5c9
 * See docs/log-message-tags/README for details.
Packit 90a5c9
 */
Packit 90a5c9
#define APLOGNO(n)              "AH" #n ": "
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * APLOG_NO_MODULE may be passed as module_index to ap_log_error() and related
Packit 90a5c9
 * functions if the module causing the log message is not known. Normally this
Packit 90a5c9
 * should not be used directly. Use ::APLOG_MARK or ::APLOG_MODULE_INDEX
Packit 90a5c9
 * instead.
Packit 90a5c9
 *
Packit 90a5c9
 * @see APLOG_MARK
Packit 90a5c9
 * @see APLOG_MODULE_INDEX
Packit 90a5c9
 * @see ap_log_error
Packit 90a5c9
 */
Packit 90a5c9
#define APLOG_NO_MODULE         -1
Packit 90a5c9
Packit 90a5c9
#ifdef __cplusplus
Packit 90a5c9
/**
Packit 90a5c9
 * C++ modules must invoke ::APLOG_USE_MODULE or ::AP_DECLARE_MODULE in
Packit 90a5c9
 * every file which uses ap_log_* before the first use of ::APLOG_MARK
Packit 90a5c9
 * or ::APLOG_MODULE_INDEX.
Packit 90a5c9
 * (C modules *should* do that as well, to enable module-specific log
Packit 90a5c9
 * levels. C modules need not obey the ordering, though).
Packit 90a5c9
 */
Packit 90a5c9
#else /* __cplusplus */
Packit 90a5c9
/**
Packit 90a5c9
 * Constant to store module_index for the current file.
Packit 90a5c9
 * Objects with static storage duration are set to NULL if not
Packit 90a5c9
 * initialized explicitly. This means that if aplog_module_index
Packit 90a5c9
 * is not initialized using the ::APLOG_USE_MODULE or the
Packit 90a5c9
 * ::AP_DECLARE_MODULE macro, we can safely fall back to
Packit 90a5c9
 * use ::APLOG_NO_MODULE. This variable will usually be optimized away.
Packit 90a5c9
 */
Packit 90a5c9
static int * const aplog_module_index;
Packit 90a5c9
#endif /* __cplusplus */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * APLOG_MODULE_INDEX contains the module_index of the current module if
Packit 90a5c9
 * it has been set via the ::APLOG_USE_MODULE or ::AP_DECLARE_MODULE macro.
Packit 90a5c9
 * Otherwise it contains ::APLOG_NO_MODULE (for example in unmodified httpd
Packit 90a5c9
 * 2.2 modules).
Packit 90a5c9
 *
Packit 90a5c9
 * If ::APLOG_MARK is used in ap_log_error() and related functions,
Packit 90a5c9
 * ::APLOG_MODULE_INDEX will be passed as module_index. In cases where
Packit 90a5c9
 * ::APLOG_MARK cannot be used, ::APLOG_MODULE_INDEX should normally be passed
Packit 90a5c9
 * as module_index.
Packit 90a5c9
 *
Packit 90a5c9
 * @see APLOG_MARK
Packit 90a5c9
 * @see ap_log_error
Packit 90a5c9
 */
Packit 90a5c9
#ifdef __cplusplus
Packit 90a5c9
#define APLOG_MODULE_INDEX (*aplog_module_index)
Packit 90a5c9
#else /* __cplusplus */
Packit 90a5c9
#define APLOG_MODULE_INDEX  \
Packit 90a5c9
    (aplog_module_index ? *aplog_module_index : APLOG_NO_MODULE)
Packit 90a5c9
#endif /* __cplusplus */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * APLOG_MAX_LOGLEVEL can be defined to remove logging above some
Packit 90a5c9
 * specified level at compile time.
Packit 90a5c9
 *
Packit 90a5c9
 * This requires a C99 compiler.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
#define APLOG_MAX_LOGLEVEL
Packit 90a5c9
#endif
Packit 90a5c9
#ifndef APLOG_MAX_LOGLEVEL
Packit 90a5c9
#define APLOG_MODULE_IS_LEVEL(s,module_index,level)              \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
Packit 90a5c9
            (s == NULL) ||                                       \
Packit 90a5c9
            (ap_get_server_module_loglevel(s, module_index)      \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) )
Packit 90a5c9
#define APLOG_C_MODULE_IS_LEVEL(c,module_index,level)            \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
Packit 90a5c9
            (ap_get_conn_module_loglevel(c, module_index)        \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) )
Packit 90a5c9
#define APLOG_CS_MODULE_IS_LEVEL(c,s,module_index,level)            \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||          \
Packit 90a5c9
            (ap_get_conn_server_module_loglevel(c, s, module_index) \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) )
Packit 90a5c9
#define APLOG_R_MODULE_IS_LEVEL(r,module_index,level)            \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
Packit 90a5c9
            (ap_get_request_module_loglevel(r, module_index)     \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) )
Packit 90a5c9
#else
Packit 90a5c9
#define APLOG_MODULE_IS_LEVEL(s,module_index,level)              \
Packit 90a5c9
        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&   \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
Packit 90a5c9
            (s == NULL) ||                                       \
Packit 90a5c9
            (ap_get_server_module_loglevel(s, module_index)      \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) ) )
Packit 90a5c9
#define APLOG_CS_MODULE_IS_LEVEL(c,s,module_index,level)            \
Packit 90a5c9
        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&      \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||          \
Packit 90a5c9
            (ap_get_conn_server_module_loglevel(c, s, module_index) \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) ) )
Packit 90a5c9
#define APLOG_C_MODULE_IS_LEVEL(c,module_index,level)            \
Packit 90a5c9
        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&   \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
Packit 90a5c9
            (ap_get_conn_module_loglevel(c, module_index)        \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) ) )
Packit 90a5c9
#define APLOG_R_MODULE_IS_LEVEL(r,module_index,level)            \
Packit 90a5c9
        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&   \
Packit 90a5c9
          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
Packit 90a5c9
            (ap_get_request_module_loglevel(r, module_index)     \
Packit 90a5c9
             >= ((level)&APLOG_LEVELMASK) ) ) )
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#define APLOG_IS_LEVEL(s,level)     \
Packit 90a5c9
    APLOG_MODULE_IS_LEVEL(s,APLOG_MODULE_INDEX,level)
Packit 90a5c9
#define APLOG_C_IS_LEVEL(c,level)   \
Packit 90a5c9
    APLOG_C_MODULE_IS_LEVEL(c,APLOG_MODULE_INDEX,level)
Packit 90a5c9
#define APLOG_CS_IS_LEVEL(c,s,level) \
Packit 90a5c9
    APLOG_CS_MODULE_IS_LEVEL(c,s,APLOG_MODULE_INDEX,level)
Packit 90a5c9
#define APLOG_R_IS_LEVEL(r,level)   \
Packit 90a5c9
    APLOG_R_MODULE_IS_LEVEL(r,APLOG_MODULE_INDEX,level)
Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
#define APLOGinfo(s)                APLOG_IS_LEVEL(s,APLOG_INFO)
Packit 90a5c9
#define APLOGdebug(s)               APLOG_IS_LEVEL(s,APLOG_DEBUG)
Packit 90a5c9
#define APLOGtrace1(s)              APLOG_IS_LEVEL(s,APLOG_TRACE1)
Packit 90a5c9
#define APLOGtrace2(s)              APLOG_IS_LEVEL(s,APLOG_TRACE2)
Packit 90a5c9
#define APLOGtrace3(s)              APLOG_IS_LEVEL(s,APLOG_TRACE3)
Packit 90a5c9
#define APLOGtrace4(s)              APLOG_IS_LEVEL(s,APLOG_TRACE4)
Packit 90a5c9
#define APLOGtrace5(s)              APLOG_IS_LEVEL(s,APLOG_TRACE5)
Packit 90a5c9
#define APLOGtrace6(s)              APLOG_IS_LEVEL(s,APLOG_TRACE6)
Packit 90a5c9
#define APLOGtrace7(s)              APLOG_IS_LEVEL(s,APLOG_TRACE7)
Packit 90a5c9
#define APLOGtrace8(s)              APLOG_IS_LEVEL(s,APLOG_TRACE8)
Packit 90a5c9
Packit 90a5c9
#define APLOGrinfo(r)               APLOG_R_IS_LEVEL(r,APLOG_INFO)
Packit 90a5c9
#define APLOGrdebug(r)              APLOG_R_IS_LEVEL(r,APLOG_DEBUG)
Packit 90a5c9
#define APLOGrtrace1(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE1)
Packit 90a5c9
#define APLOGrtrace2(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE2)
Packit 90a5c9
#define APLOGrtrace3(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE3)
Packit 90a5c9
#define APLOGrtrace4(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE4)
Packit 90a5c9
#define APLOGrtrace5(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE5)
Packit 90a5c9
#define APLOGrtrace6(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE6)
Packit 90a5c9
#define APLOGrtrace7(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE7)
Packit 90a5c9
#define APLOGrtrace8(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE8)
Packit 90a5c9
Packit 90a5c9
#define APLOGcinfo(c)               APLOG_C_IS_LEVEL(c,APLOG_INFO)
Packit 90a5c9
#define APLOGcdebug(c)              APLOG_C_IS_LEVEL(c,APLOG_DEBUG)
Packit 90a5c9
#define APLOGctrace1(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE1)
Packit 90a5c9
#define APLOGctrace2(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE2)
Packit 90a5c9
#define APLOGctrace3(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE3)
Packit 90a5c9
#define APLOGctrace4(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE4)
Packit 90a5c9
#define APLOGctrace5(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE5)
Packit 90a5c9
#define APLOGctrace6(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE6)
Packit 90a5c9
#define APLOGctrace7(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE7)
Packit 90a5c9
#define APLOGctrace8(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE8)
Packit 90a5c9
Packit 90a5c9
AP_DECLARE_DATA extern int ap_default_loglevel;
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * APLOG_MARK is a convenience macro for use as the first three parameters in
Packit 90a5c9
 * ap_log_error() and related functions, i.e. file, line, and module_index.
Packit 90a5c9
 *
Packit 90a5c9
 * The module_index parameter was introduced in version 2.3.6. Before that
Packit 90a5c9
 * version, APLOG_MARK only replaced the file and line parameters.
Packit 90a5c9
 * This means that APLOG_MARK can be used with ap_log_*error in all versions
Packit 90a5c9
 * of Apache httpd.
Packit 90a5c9
 *
Packit 90a5c9
 * @see APLOG_MODULE_INDEX
Packit 90a5c9
 * @see ap_log_error
Packit 90a5c9
 * @see ap_log_cerror
Packit 90a5c9
 * @see ap_log_rerror
Packit 90a5c9
 * @see ap_log_cserror
Packit 90a5c9
 */
Packit 90a5c9
#define APLOG_MARK     __FILE__,__LINE__,APLOG_MODULE_INDEX
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Set up for logging to stderr.
Packit 90a5c9
 * @param p The pool to allocate out of
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_open_stderr_log(apr_pool_t *p);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Replace logging to stderr with logging to the given file.
Packit 90a5c9
 * @param p The pool to allocate out of
Packit 90a5c9
 * @param file Name of the file to log stderr output
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_replace_stderr_log(apr_pool_t *p,
Packit 90a5c9
                                               const char *file);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Open the error log and replace stderr with it.
Packit 90a5c9
 * @param pconf Not used
Packit 90a5c9
 * @param plog  The pool to allocate the logs from
Packit 90a5c9
 * @param ptemp Pool used for temporary allocations
Packit 90a5c9
 * @param s_main The main server
Packit 90a5c9
 * @note ap_open_logs isn't expected to be used by modules, it is
Packit 90a5c9
 * an internal core function
Packit 90a5c9
 */
Packit 90a5c9
int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog,
Packit 90a5c9
                 apr_pool_t *ptemp, server_rec *s_main);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Perform special processing for piped loggers in MPM child
Packit 90a5c9
 * processes.
Packit 90a5c9
 * @param p Not used
Packit 90a5c9
 * @param s Not used
Packit 90a5c9
 * @note ap_logs_child_init is not for use by modules; it is an
Packit 90a5c9
 * internal core function
Packit 90a5c9
 */
Packit 90a5c9
void ap_logs_child_init(apr_pool_t *p, server_rec *s);
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * The primary logging functions, ap_log_error, ap_log_rerror, ap_log_cerror,
Packit 90a5c9
 * and ap_log_perror use a printf style format string to build the log message.
Packit 90a5c9
 * It is VERY IMPORTANT that you not include any raw data from the network,
Packit 90a5c9
 * such as the request-URI or request header fields, within the format
Packit 90a5c9
 * string.  Doing so makes the server vulnerable to a denial-of-service
Packit 90a5c9
 * attack and other messy behavior.  Instead, use a simple format string
Packit 90a5c9
 * like "%s", followed by the string containing the untrusted data.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_error() - log messages which are not related to a particular
Packit 90a5c9
 * request or connection.  This uses a printf-like format to log messages
Packit 90a5c9
 * to the error_log.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param module_index The module_index of the module generating this message
Packit 90a5c9
 * @param level The level of this error message
Packit 90a5c9
 * @param status The status code from the previous command
Packit 90a5c9
 * @param s The server on which we are logging
Packit 90a5c9
 * @param fmt The format string
Packit 90a5c9
 * @param ... The arguments to use to fill out fmt.
Packit 90a5c9
 * @note ap_log_error is implemented as a macro
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file and line
Packit 90a5c9
 * @note If a request_rec is available, use that with ap_log_rerror()
Packit 90a5c9
 * in preference to calling this function.  Otherwise, if a conn_rec is
Packit 90a5c9
 * available, use that with ap_log_cerror() in preference to calling
Packit 90a5c9
 * this function.
Packit 90a5c9
 * @warning It is VERY IMPORTANT that you not include any raw data from
Packit 90a5c9
 * the network, such as the request-URI or request header fields, within
Packit 90a5c9
 * the format string.  Doing so makes the server vulnerable to a
Packit 90a5c9
 * denial-of-service attack and other messy behavior.  Instead, use a
Packit 90a5c9
 * simple format string like "%s", followed by the string containing the
Packit 90a5c9
 * untrusted data.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_error(const char *file, int line, int module_index,
Packit 90a5c9
                              int level, apr_status_t status,
Packit 90a5c9
                              const server_rec *s, const char *fmt, ...);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_error(...) ap_log_error__(__VA_ARGS__)
Packit 90a5c9
/* need server_rec *sr = ... for the case if s is verbatim NULL */
Packit 90a5c9
#define ap_log_error__(file, line, mi, level, status, s, ...)           \
Packit 90a5c9
    do { const server_rec *sr__ = s; if (APLOG_MODULE_IS_LEVEL(sr__, mi, level)) \
Packit 90a5c9
             ap_log_error_(file, line, mi, level, status, sr__, __VA_ARGS__);    \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_error ap_log_error_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_error_(const char *file, int line, int module_index,
Packit 90a5c9
                               int level, apr_status_t status,
Packit 90a5c9
                               const server_rec *s, const char *fmt, ...)
Packit 90a5c9
                              __attribute__((format(printf,7,8)));
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_perror() - log messages which are not related to a particular
Packit 90a5c9
 * request, connection, or virtual server.  This uses a printf-like
Packit 90a5c9
 * format to log messages to the error_log.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param module_index ignored dummy value for use by APLOG_MARK
Packit 90a5c9
 * @param level The level of this error message
Packit 90a5c9
 * @param status The status code from the previous command
Packit 90a5c9
 * @param p The pool which we are logging for
Packit 90a5c9
 * @param fmt The format string
Packit 90a5c9
 * @param ... The arguments to use to fill out fmt.
Packit 90a5c9
 * @note ap_log_perror is implemented as a macro
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @warning It is VERY IMPORTANT that you not include any raw data from
Packit 90a5c9
 * the network, such as the request-URI or request header fields, within
Packit 90a5c9
 * the format string.  Doing so makes the server vulnerable to a
Packit 90a5c9
 * denial-of-service attack and other messy behavior.  Instead, use a
Packit 90a5c9
 * simple format string like "%s", followed by the string containing the
Packit 90a5c9
 * untrusted data.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_perror(const char *file, int line, int module_index,
Packit 90a5c9
                               int level, apr_status_t status, apr_pool_t *p,
Packit 90a5c9
                               const char *fmt, ...);
Packit 90a5c9
#else
Packit 90a5c9
#if defined(AP_HAVE_C99) && defined(APLOG_MAX_LOGLEVEL)
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
Packit 90a5c9
#define ap_log_perror__(file, line, mi, level, status, p, ...)            \
Packit 90a5c9
    do { if ((level) <= APLOG_MAX_LOGLEVEL )                              \
Packit 90a5c9
             ap_log_perror_(file, line, mi, level, status, p,             \
Packit 90a5c9
                            __VA_ARGS__); } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_perror ap_log_perror_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_perror_(const char *file, int line, int module_index,
Packit 90a5c9
                                int level, apr_status_t status, apr_pool_t *p,
Packit 90a5c9
                                const char *fmt, ...)
Packit 90a5c9
                               __attribute__((format(printf,7,8)));
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_rerror() - log messages which are related to a particular
Packit 90a5c9
 * request.  This uses a printf-like format to log messages to the
Packit 90a5c9
 * error_log.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param module_index The module_index of the module generating this message
Packit 90a5c9
 * @param level The level of this error message
Packit 90a5c9
 * @param status The status code from the previous command
Packit 90a5c9
 * @param r The request which we are logging for
Packit 90a5c9
 * @param fmt The format string
Packit 90a5c9
 * @param ... The arguments to use to fill out fmt.
Packit 90a5c9
 * @note ap_log_rerror is implemented as a macro
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @warning It is VERY IMPORTANT that you not include any raw data from
Packit 90a5c9
 * the network, such as the request-URI or request header fields, within
Packit 90a5c9
 * the format string.  Doing so makes the server vulnerable to a
Packit 90a5c9
 * denial-of-service attack and other messy behavior.  Instead, use a
Packit 90a5c9
 * simple format string like "%s", followed by the string containing the
Packit 90a5c9
 * untrusted data.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_rerror(const char *file, int line, int module_index,
Packit 90a5c9
                               int level, apr_status_t status,
Packit 90a5c9
                               const request_rec *r, const char *fmt, ...);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_rerror(...) ap_log_rerror__(__VA_ARGS__)
Packit 90a5c9
#define ap_log_rerror__(file, line, mi, level, status, r, ...)              \
Packit 90a5c9
    do { if (APLOG_R_MODULE_IS_LEVEL(r, mi, level))                         \
Packit 90a5c9
             ap_log_rerror_(file, line, mi, level, status, r, __VA_ARGS__); \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_rerror ap_log_rerror_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_rerror_(const char *file, int line, int module_index,
Packit 90a5c9
                                int level, apr_status_t status,
Packit 90a5c9
                                const request_rec *r, const char *fmt, ...)
Packit 90a5c9
                                __attribute__((format(printf,7,8)));
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_cerror() - log messages which are related to a particular
Packit 90a5c9
 * connection.  This uses a printf-like format to log messages to the
Packit 90a5c9
 * error_log.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param level The level of this error message
Packit 90a5c9
 * @param module_index The module_index of the module generating this message
Packit 90a5c9
 * @param status The status code from the previous command
Packit 90a5c9
 * @param c The connection which we are logging for
Packit 90a5c9
 * @param fmt The format string
Packit 90a5c9
 * @param ... The arguments to use to fill out fmt.
Packit 90a5c9
 * @note ap_log_cerror is implemented as a macro
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @note If a request_rec is available, use that with ap_log_rerror()
Packit 90a5c9
 * in preference to calling this function.
Packit 90a5c9
 * @warning It is VERY IMPORTANT that you not include any raw data from
Packit 90a5c9
 * the network, such as the request-URI or request header fields, within
Packit 90a5c9
 * the format string.  Doing so makes the server vulnerable to a
Packit 90a5c9
 * denial-of-service attack and other messy behavior.  Instead, use a
Packit 90a5c9
 * simple format string like "%s", followed by the string containing the
Packit 90a5c9
 * untrusted data.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_cerror(const char *file, int line, int module_index,
Packit 90a5c9
                               int level, apr_status_t status,
Packit 90a5c9
                               const conn_rec *c, const char *fmt, ...);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_cerror(...) ap_log_cerror__(__VA_ARGS__)
Packit 90a5c9
#define ap_log_cerror__(file, line, mi, level, status, c, ...)              \
Packit 90a5c9
    do { if (APLOG_C_MODULE_IS_LEVEL(c, mi, level))                         \
Packit 90a5c9
             ap_log_cerror_(file, line, mi, level, status, c, __VA_ARGS__); \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_cerror ap_log_cerror_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_cerror_(const char *file, int line, int module_index,
Packit 90a5c9
                                int level, apr_status_t status,
Packit 90a5c9
                                const conn_rec *c, const char *fmt, ...)
Packit 90a5c9
                                __attribute__((format(printf,7,8)));
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_cserror() - log messages which are related to a particular
Packit 90a5c9
 * connection and to a vhost other than c->base_server.  This uses a
Packit 90a5c9
 * printf-like format to log messages to the error_log.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param level The level of this error message
Packit 90a5c9
 * @param module_index The module_index of the module generating this message
Packit 90a5c9
 * @param status The status code from the previous command
Packit 90a5c9
 * @param c The connection which we are logging for
Packit 90a5c9
 * @param s The server which we are logging for
Packit 90a5c9
 * @param fmt The format string
Packit 90a5c9
 * @param ... The arguments to use to fill out fmt.
Packit 90a5c9
 * @note ap_log_cserror is implemented as a macro
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @note If a request_rec is available, use that with ap_log_rerror()
Packit 90a5c9
 * in preference to calling this function. This function is mainly useful for
Packit 90a5c9
 * modules like mod_ssl to use before the request_rec is created.
Packit 90a5c9
 * @warning It is VERY IMPORTANT that you not include any raw data from
Packit 90a5c9
 * the network, such as the request-URI or request header fields, within
Packit 90a5c9
 * the format string.  Doing so makes the server vulnerable to a
Packit 90a5c9
 * denial-of-service attack and other messy behavior.  Instead, use a
Packit 90a5c9
 * simple format string like "%s", followed by the string containing the
Packit 90a5c9
 * untrusted data.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_cserror(const char *file, int line, int module_index,
Packit 90a5c9
                                int level, apr_status_t status,
Packit 90a5c9
                                const conn_rec *c, const server_rec *s,
Packit 90a5c9
                                const char *fmt, ...);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_cserror(...) ap_log_cserror__(__VA_ARGS__)
Packit 90a5c9
#define ap_log_cserror__(file, line, mi, level, status, c, s, ...)  \
Packit 90a5c9
    do { if (APLOG_CS_MODULE_IS_LEVEL(c, s, mi, level))             \
Packit 90a5c9
             ap_log_cserror_(file, line, mi, level, status, c, s,   \
Packit 90a5c9
                             __VA_ARGS__);                          \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_cserror ap_log_cserror_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_cserror_(const char *file, int line, int module_index,
Packit 90a5c9
                                 int level, apr_status_t status,
Packit 90a5c9
                                 const conn_rec *c, const server_rec *s,
Packit 90a5c9
                                 const char *fmt, ...)
Packit 90a5c9
                             __attribute__((format(printf,8,9)));
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * The buffer logging functions, ap_log_data, ap_log_rdata, ap_log_cdata,
Packit 90a5c9
 * and ap_log_csdata log a buffer in printable and hex format.  The exact
Packit 90a5c9
 * format is controlled by processing flags, described next.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Processing flags for ap_log_data() et al
Packit 90a5c9
 *
Packit 90a5c9
 * AP_LOG_DATA_DEFAULT - default formatting, with printable chars and hex
Packit 90a5c9
 * AP_LOG_DATA_SHOW_OFFSET - prefix each line with hex offset from the start
Packit 90a5c9
 * of the buffer
Packit 90a5c9
 */
Packit 90a5c9
#define AP_LOG_DATA_DEFAULT       0
Packit 90a5c9
#define AP_LOG_DATA_SHOW_OFFSET   1
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_data() - log buffers which are not related to a particular request
Packit 90a5c9
 * or connection.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param module_index The module_index of the module logging this buffer
Packit 90a5c9
 * @param level The log level
Packit 90a5c9
 * @param s The server on which we are logging
Packit 90a5c9
 * @param label A label for the buffer, to be logged preceding the buffer
Packit 90a5c9
 * @param data The buffer to be logged
Packit 90a5c9
 * @param len The length of the buffer
Packit 90a5c9
 * @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
Packit 90a5c9
 * @note ap_log_data is implemented as a macro.
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @note If a request_rec is available, use that with ap_log_rdata()
Packit 90a5c9
 * in preference to calling this function.  Otherwise, if a conn_rec is
Packit 90a5c9
 * available, use that with ap_log_cdata() in preference to calling
Packit 90a5c9
 * this function.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_data(const char *file, int line, int module_index,
Packit 90a5c9
                             int level, const server_rec *s, const char *label,
Packit 90a5c9
                             const void *data, apr_size_t len, unsigned int flags);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_data(...) ap_log_data__(__VA_ARGS__)
Packit 90a5c9
/* need server_rec *sr = ... for the case if s is verbatim NULL */
Packit 90a5c9
#define ap_log_data__(file, line, mi, level, s, ...)           \
Packit 90a5c9
    do { const server_rec *sr__ = s; if (APLOG_MODULE_IS_LEVEL(sr__, mi, level)) \
Packit 90a5c9
             ap_log_data_(file, line, mi, level, sr__, __VA_ARGS__);    \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_data ap_log_data_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_data_(const char *file, int line, int module_index,
Packit 90a5c9
                              int level, const server_rec *s, const char *label,
Packit 90a5c9
                              const void *data, apr_size_t len, unsigned int flags);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_rdata() - log buffers which are related to a particular request.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param module_index The module_index of the module logging this buffer
Packit 90a5c9
 * @param level The log level
Packit 90a5c9
 * @param r The request which we are logging for
Packit 90a5c9
 * @param label A label for the buffer, to be logged preceding the buffer
Packit 90a5c9
 * @param data The buffer to be logged
Packit 90a5c9
 * @param len The length of the buffer
Packit 90a5c9
 * @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
Packit 90a5c9
 * @note ap_log_rdata is implemented as a macro.
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @note If a request_rec is available, use that with ap_log_rerror()
Packit 90a5c9
 * in preference to calling this function.  Otherwise, if a conn_rec is
Packit 90a5c9
 * available, use that with ap_log_cerror() in preference to calling
Packit 90a5c9
 * this function.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_rdata(const char *file, int line, int module_index,
Packit 90a5c9
                              int level, const request_rec *r, const char *label,
Packit 90a5c9
                              const void *data, apr_size_t len, unsigned int flags);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_rdata(...) ap_log_rdata__(__VA_ARGS__)
Packit 90a5c9
#define ap_log_rdata__(file, line, mi, level, r, ...)           \
Packit 90a5c9
    do { if (APLOG_R_MODULE_IS_LEVEL(r, mi, level)) \
Packit 90a5c9
             ap_log_rdata_(file, line, mi, level, r, __VA_ARGS__);    \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_rdata ap_log_rdata_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_rdata_(const char *file, int line, int module_index,
Packit 90a5c9
                               int level, const request_rec *r, const char *label,
Packit 90a5c9
                               const void *data, apr_size_t len, unsigned int flags);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_cdata() - log buffers which are related to a particular connection.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param module_index The module_index of the module logging this buffer
Packit 90a5c9
 * @param level The log level
Packit 90a5c9
 * @param c The connection which we are logging for
Packit 90a5c9
 * @param label A label for the buffer, to be logged preceding the buffer
Packit 90a5c9
 * @param data The buffer to be logged
Packit 90a5c9
 * @param len The length of the buffer
Packit 90a5c9
 * @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
Packit 90a5c9
 * @note ap_log_cdata is implemented as a macro
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @note If a request_rec is available, use that with ap_log_rerror()
Packit 90a5c9
 * in preference to calling this function.  Otherwise, if a conn_rec is
Packit 90a5c9
 * available, use that with ap_log_cerror() in preference to calling
Packit 90a5c9
 * this function.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_cdata(const char *file, int line, int module_index,
Packit 90a5c9
                              int level, const conn_rec *c, const char *label,
Packit 90a5c9
                              const void *data, apr_size_t len, unsigned int flags);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_cdata(...) ap_log_cdata__(__VA_ARGS__)
Packit 90a5c9
#define ap_log_cdata__(file, line, mi, level, c, ...)           \
Packit 90a5c9
    do { if (APLOG_C_MODULE_IS_LEVEL(c, mi, level)) \
Packit 90a5c9
             ap_log_cdata_(file, line, mi, level, c, __VA_ARGS__);    \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_cdata ap_log_cdata_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_cdata_(const char *file, int line, int module_index,
Packit 90a5c9
                               int level, const conn_rec *c, const char *label,
Packit 90a5c9
                               const void *data, apr_size_t len, unsigned int flags);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * ap_log_csdata() - log buffers which are related to a particular connection
Packit 90a5c9
 * and to a vhost other than c->base_server.
Packit 90a5c9
 * @param file The file in which this function is called
Packit 90a5c9
 * @param line The line number on which this function is called
Packit 90a5c9
 * @param module_index The module_index of the module logging this buffer
Packit 90a5c9
 * @param level The log level
Packit 90a5c9
 * @param c The connection which we are logging for
Packit 90a5c9
 * @param s The server which we are logging for
Packit 90a5c9
 * @param label A label for the buffer, to be logged preceding the buffer
Packit 90a5c9
 * @param data The buffer to be logged
Packit 90a5c9
 * @param len The length of the buffer
Packit 90a5c9
 * @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
Packit 90a5c9
 * @note ap_log_csdata is implemented as a macro
Packit 90a5c9
 * @note Use APLOG_MARK to fill out file, line, and module_index
Packit 90a5c9
 * @note If a request_rec is available, use that with ap_log_rerror()
Packit 90a5c9
 * in preference to calling this function.  Otherwise, if a conn_rec is
Packit 90a5c9
 * available, use that with ap_log_cerror() in preference to calling
Packit 90a5c9
 * this function.
Packit 90a5c9
 */
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
AP_DECLARE(void) ap_log_csdata(const char *file, int line, int module_index,
Packit 90a5c9
                               int level, const conn_rec *c, const server_rec *s,
Packit 90a5c9
                               const char *label, const void *data,
Packit 90a5c9
                               apr_size_t len, unsigned int flags);
Packit 90a5c9
#else
Packit 90a5c9
#ifdef AP_HAVE_C99
Packit 90a5c9
/* need additional step to expand APLOG_MARK first */
Packit 90a5c9
#define ap_log_csdata(...) ap_log_csdata__(__VA_ARGS__)
Packit 90a5c9
#define ap_log_csdata__(file, line, mi, level, c, s, ...)              \
Packit 90a5c9
    do { if (APLOG_CS_MODULE_IS_LEVEL(c, s, mi, level))                \
Packit 90a5c9
             ap_log_csdata_(file, line, mi, level, c, s, __VA_ARGS__); \
Packit 90a5c9
    } while(0)
Packit 90a5c9
#else
Packit 90a5c9
#define ap_log_cdata ap_log_cdata_
Packit 90a5c9
#endif
Packit 90a5c9
AP_DECLARE(void) ap_log_csdata_(const char *file, int line, int module_index,
Packit 90a5c9
                                int level, const conn_rec *c, const server_rec *s,
Packit 90a5c9
                                const char *label, const void *data,
Packit 90a5c9
                                apr_size_t len, unsigned int flags);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Convert stderr to the error log
Packit 90a5c9
 * @param s The current server
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_error_log2stderr(server_rec *s);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Log the command line used to start the server.
Packit 90a5c9
 * @param p The pool to use for logging
Packit 90a5c9
 * @param s The server_rec whose process's command line we want to log.
Packit 90a5c9
 * The command line is logged to that server's error log.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_log_command_line(apr_pool_t *p, server_rec *s);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Log common (various) MPM shared data at startup.
Packit 90a5c9
 * @param s The server_rec of the error log we want to log to.
Packit 90a5c9
 * Misc commonly logged data is logged to that server's error log.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_log_mpm_common(server_rec *s);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Log the current pid of the parent process
Packit 90a5c9
 * @param p The pool to use for processing
Packit 90a5c9
 * @param fname The name of the file to log to.  If the filename is not
Packit 90a5c9
 * absolute then it is assumed to be relative to ServerRoot.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Remove the pidfile.
Packit 90a5c9
 * @param p The pool to use for processing
Packit 90a5c9
 * @param fname The name of the pid file to remove.  If the filename is not
Packit 90a5c9
 * absolute then it is assumed to be relative to ServerRoot.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *fname);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Retrieve the pid from a pidfile.
Packit 90a5c9
 * @param p The pool to use for processing
Packit 90a5c9
 * @param filename The name of the file containing the pid.  If the filename is not
Packit 90a5c9
 * absolute then it is assumed to be relative to ServerRoot.
Packit 90a5c9
 * @param mypid Pointer to pid_t (valid only if return APR_SUCCESS)
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename, pid_t *mypid);
Packit 90a5c9
Packit 90a5c9
/** @see piped_log */
Packit 90a5c9
typedef struct piped_log piped_log;
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Open the piped log process
Packit 90a5c9
 * @param p The pool to allocate out of
Packit 90a5c9
 * @param program The program to run in the logging process
Packit 90a5c9
 * @return The piped log structure
Packit 90a5c9
 * @note The log program is invoked as @p APR_PROGRAM_ENV,
Packit 90a5c9
 *      @see ap_open_piped_log_ex to modify this behavior
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Open the piped log process specifying the execution choice for program
Packit 90a5c9
 * @param p The pool to allocate out of
Packit 90a5c9
 * @param program The program to run in the logging process
Packit 90a5c9
 * @param cmdtype How to invoke program, e.g. APR_PROGRAM, APR_SHELLCMD_ENV, etc
Packit 90a5c9
 * @return The piped log structure
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(piped_log *) ap_open_piped_log_ex(apr_pool_t *p,
Packit 90a5c9
                                             const char *program,
Packit 90a5c9
                                             apr_cmdtype_e cmdtype);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Close the piped log and kill the logging process
Packit 90a5c9
 * @param pl The piped log structure
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_close_piped_log(piped_log *pl);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * A function to return the read side of the piped log pipe
Packit 90a5c9
 * @param pl The piped log structure
Packit 90a5c9
 * @return The native file descriptor
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_file_t *) ap_piped_log_read_fd(piped_log *pl);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * A function to return the write side of the piped log pipe
Packit 90a5c9
 * @param pl The piped log structure
Packit 90a5c9
 * @return The native file descriptor
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * hook method to generate unique id for connection or request
Packit 90a5c9
 * @ingroup hooks
Packit 90a5c9
 * @param c the conn_rec of the connections
Packit 90a5c9
 * @param r the request_req (may be NULL)
Packit 90a5c9
 * @param id the place where to store the unique id
Packit 90a5c9
 * @return OK or DECLINE
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_HOOK(int, generate_log_id,
Packit 90a5c9
                (const conn_rec *c, const request_rec *r, const char **id))
Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
#ifdef __cplusplus
Packit 90a5c9
}
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#endif  /* !APACHE_HTTP_LOG_H */
Packit 90a5c9
/** @} */