1 /* ====================================================================
2 * Copyright (c) 1995-1999 The Apache Group. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the Apache Group
19 * for use in the Apache HTTP server project (http://www.apache.org/)."
21 * 4. The names "Apache Server" and "Apache Group" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For written permission, please contact
26 * 5. Products derived from this software may not be called "Apache"
27 * nor may "Apache" appear in their names without prior written
28 * permission of the Apache Group.
30 * 6. Redistributions of any form whatsoever must retain the following
32 * "This product includes software developed by the Apache Group
33 * for use in the Apache HTTP server project (http://www.apache.org/)."
35 * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Group and was originally based
51 * on public domain software written at the National Center for
52 * Supercomputing Applications, University of Illinois, Urbana-Champaign.
53 * For more information on the Apache Group and the Apache HTTP server
54 * project, please see <http://www.apache.org/>.
58 #ifndef APACHE_HTTP_LOG_H
59 #define APACHE_HTTP_LOG_H
68 #define APLOG_EMERG LOG_EMERG /* system is unusable */
69 #define APLOG_ALERT LOG_ALERT /* action must be taken immediately */
70 #define APLOG_CRIT LOG_CRIT /* critical conditions */
71 #define APLOG_ERR LOG_ERR /* error conditions */
72 #define APLOG_WARNING LOG_WARNING /* warning conditions */
73 #define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */
74 #define APLOG_INFO LOG_INFO /* informational */
75 #define APLOG_DEBUG LOG_DEBUG /* debug-level messages */
77 #define APLOG_LEVELMASK LOG_PRIMASK /* mask off the level value */
81 #define APLOG_EMERG 0 /* system is unusable */
82 #define APLOG_ALERT 1 /* action must be taken immediately */
83 #define APLOG_CRIT 2 /* critical conditions */
84 #define APLOG_ERR 3 /* error conditions */
85 #define APLOG_WARNING 4 /* warning conditions */
86 #define APLOG_NOTICE 5 /* normal but significant condition */
87 #define APLOG_INFO 6 /* informational */
88 #define APLOG_DEBUG 7 /* debug-level messages */
90 #define APLOG_LEVELMASK 7 /* mask off the level value */
94 #define APLOG_NOERRNO (APLOG_LEVELMASK + 1)
96 /* Set to indicate that error msg should come from Win32's GetLastError(),
98 #define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
101 #ifndef DEFAULT_LOGLEVEL
102 #define DEFAULT_LOGLEVEL APLOG_WARNING
105 #define APLOG_MARK __FILE__,__LINE__
107 void ap_open_logs (server_rec *, ap_context_t *p);
109 /* The two primary logging functions, ap_log_error and ap_log_rerror,
110 * use a printf style format string to build the log message. It is
111 * VERY IMPORTANT that you not include any raw data from the network,
112 * such as the request-URI or request header fields, within the format
113 * string. Doing so makes the server vulnerable to a denial-of-service
114 * attack and other messy behavior. Instead, use a simple format string
115 * like "%s", followed by the string containing the untrusted data.
117 API_EXPORT(void) ap_log_error(const char *file, int line, int level,
118 const server_rec *s, const char *fmt, ...)
119 __attribute__((format(printf,5,6)));
120 API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
121 const request_rec *s, const char *fmt, ...)
122 __attribute__((format(printf,5,6)));
123 API_EXPORT(void) ap_error_log2stderr (server_rec *);
125 void ap_log_pid (ap_context_t *p, const char *fname);
126 /* These are for legacy code, new code should use ap_log_error,
129 API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s);
130 API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
131 const char *msg, server_rec *s);
132 API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
133 __attribute__((format(printf,2,3)));
134 API_EXPORT(void) ap_log_reason(const char *reason, const char *fname,
137 typedef struct piped_log {
139 #ifndef NO_RELIABLE_PIPED_LOGS
148 API_EXPORT(piped_log *) ap_open_piped_log (ap_context_t *p, const char *program);
149 API_EXPORT(void) ap_close_piped_log (piped_log *);
150 #ifndef NO_RELIABLE_PIPED_LOGS
151 #define ap_piped_log_read_fd(pl) ((pl)->fds[0])
152 #define ap_piped_log_write_fd(pl) ((pl)->fds[1])
154 #define ap_piped_log_read_fd(pl) (-1)
155 #define ap_piped_log_write_fd(pl) ((pl)->write_f)
162 #endif /* !APACHE_HTTP_LOG_H */