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