log.c revision b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44c
809N/A/* ==================================================================== 2362N/A * Copyright (c) 1995-1999 The Apache Group. All rights reserved. 809N/A * Redistribution and use in source and binary forms, with or without 809N/A * modification, are permitted provided that the following conditions 809N/A * 1. Redistributions of source code must retain the above copyright 809N/A * notice, this list of conditions and the following disclaimer. 809N/A * 2. Redistributions in binary form must reproduce the above copyright 809N/A * notice, this list of conditions and the following disclaimer in 809N/A * the documentation and/or other materials provided with the 809N/A * 3. All advertising materials mentioning features or use of this 809N/A * software must display the following acknowledgment: 809N/A * "This product includes software developed by the Apache Group 2362N/A * 4. The names "Apache Server" and "Apache Group" must not be used to 809N/A * endorse or promote products derived from this software without 809N/A * prior written permission. For written permission, please contact 809N/A * 5. Products derived from this software may not be called "Apache" 809N/A * nor may "Apache" appear in their names without prior written 809N/A * permission of the Apache Group. 809N/A * 6. Redistributions of any form whatsoever must retain the following * "This product includes software developed by the Apache Group * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Group and was originally based * on public domain software written at the National Center for * Supercomputing Applications, University of Illinois, Urbana-Champaign. * For more information on the Apache Group and the Apache HTTP server /* Child process code for 'ErrorLog "|..."'; * may want a common framework for this, since I expect it will * be common for other foo-loggers to want this sort of thing... /* No concept of a child process on Win32 */ /* Something bad happened, give up and go away. */ /* This starts a new process... */ "Couldn't fork child for ErrorLog process");
/* Change to AP funcs. */ "%s: could not open error log file %s.",
/* replace stderr with this new log */ "unable to replace stderr with error_log");
/* note that stderr may still need to be replaced with something * because it points to the old error log, or back to the tty "unable to replace stderr with /dev/null");
* If we are doing stderr logging (startup), don't log messages that are * If we are doing normal logging, don't log messages that are * If we are doing normal logging, don't log messages that are * If we are doing syslog logging, don't log messages that are /* In OSD/POSIX, the compiler returns for __FILE__ * (it even returns an absolute path for sources in * the current directory). Here we try to strip this if (e !=
NULL && e[
1] !=
'\0') {
/* XXX: TODO: add a method of selecting whether logged client * addresses are in dotted quad or resolved form... dotted * quad is the most secure, which is why I'm implementing it /* XXX - need an APRized strerror() */ /* NULL if we are logging to syslog */ /* We know that we have one more character of space available because * the array is sized that way */ /* ap_assert(len < MAX_STRING_LEN) */ * IF the error level is 'warning' or more severe, * AND there isn't already error text associated with this request, * THEN make the message text available to ErrorDocument and * other error processors. This can be disabled by stuffing * something, even an empty string, into the "error-notes" cell * before calling this routine. /* WINCH and HUP call this on each restart. * Only warn on first time through for this pid. * XXX: Could just write first time through too, although * that may screw up scripts written to do something * based on the last modification time of the pid file. "pid file %s overwritten -- Unclean shutdown of previous Apache run?",
"%s: could not log pid to file %s",
"access to %s failed for %s, reason: %s",
"[%s] file %s, line %d, assertion \"%s\" failed",
/* unix assert does an abort leading to a core dump */ /* forward declaration */ /* pjr - calls to block and unblock alarms weren't here before, was this */ /* an oversight or intentional? */ /* Something bad happened, give up and go away. */ "piped_log_spawn: unable to exec '%s': %s",
if (
rc ==
APR_SUCCESS) {
/* pjr - This no longer happens inside the child, */ /* successful that the child is running. */ /* ap_unblock_alarms(); */ /* what can we do? This could be the error log we're having * problems opening up... */ "piped_log_maintenance: unable to respawn '%s': %s",
"Couldn't fork child for piped log process");