/* copyright 1999-2004 the apache software foundation
*
* licensed under the apache license, version 2.0 (the "license");
* you may not use this file except in compliance with the license.
* you may obtain a copy of the license at
*
* http://www.apache.org/licenses/license-2.0
*
* unless required by applicable law or agreed to in writing, software
* distributed under the license is distributed on an "as is" basis,
* without warranties or conditions of any kind, either express or implied.
* see the license for the specific language governing permissions and
* limitations under the license.
*/
/*
* http_log.c: dealing with the logs and errors
*
* rob mccool
*
*/
#include "apr.h"
#include "apr_general.h" /* for signal stuff */
#include "apr_strings.h"
#include "apr_errno.h"
#include "apr_thread_proc.h"
#include "apr_lib.h"
#include "apr_signal.h"
#define apr_want_stdio
#define apr_want_strfunc
#include "apr_want.h"
#if apr_have_stdarg_h
#include <stdarg.h>
#endif
#if apr_have_unistd_h
#include <unistd.h>
#endif
#define core_private
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_main.h"
#include "util_time.h"
#include "ap_mpm.h"
typedef struct {
char *t_name;
int t_val;
} trans;
apr_hook_struct(
apr_hook_link(error_log)
)
int ap_declare_data ap_default_loglevel = default_loglevel;
#ifdef have_syslog
static const trans facilities[] = {
{"auth", log_auth},
#ifdef log_authpriv
{"authpriv",log_authpriv},
#endif
#ifdef log_cron
{"cron", log_cron},
#endif
#ifdef log_daemon
{"daemon", log_daemon},
#endif
#ifdef log_ftp
{"ftp", log_ftp},
#endif
#ifdef log_kern
{"kern", log_kern},
#endif
#ifdef log_lpr
{"lpr", log_lpr},
#endif
#ifdef log_mail
{"mail", log_mail},
#endif
#ifdef log_news
{"news", log_news},
#endif
#ifdef log_syslog
{"syslog", log_syslog},
#endif
#ifdef log_user
{"user", log_user},
#endif
#ifdef log_uucp
{"uucp", log_uucp},
#endif
#ifdef log_local0
{"local0", log_local0},
#endif
#ifdef log_local1
{"local1", log_local1},
#endif
#ifdef log_local2
{"local2", log_local2},
#endif
#ifdef log_local3
{"local3", log_local3},
#endif
#ifdef log_local4
{"local4", log_local4},
#endif
#ifdef log_local5
{"local5", log_local5},
#endif
#ifdef log_local6
{"local6", log_local6},
#endif
#ifdef log_local7
{"local7", log_local7},
#endif
{null, -1},
};
#endif
static const trans priorities[] = {
{"emerg", aplog_emerg},
{"alert", aplog_alert},
{"crit", aplog_crit},
{"error", aplog_err},
{"warn", aplog_warning},
{"notice", aplog_notice},
{"info", aplog_info},
{"debug", aplog_debug},
{null, -1},
};
static apr_file_t *stderr_log = null;
ap_declare(void) ap_open_stderr_log(apr_pool_t *p)
{
apr_file_open_stderr(&stderr_log, p);
}
ap_declare(apr_status_t) ap_replace_stderr_log(apr_pool_t *p,
const char *fname)
{
apr_file_t *stderr_file;
apr_status_t rc;