View | Details | Raw Unified | Return to bug 57742
Collapse All | Expand All

(-)a/docs/manual/mod/core.xml (-1 / +3 lines)
Lines 1354-1360 ErrorDocument 404 /cgi-bin/bad_urls.pl Link Here
1354
    <highlight language="config">ErrorLog "|/usr/local/bin/httpd_errors"</highlight>
1354
    <highlight language="config">ErrorLog "|/usr/local/bin/httpd_errors"</highlight>
1355
1355
1356
    <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1356
    <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1357
    more information.</p>
1357
    more information. Note that piped logging of the main error log is
1358
    <strong>not</strong> reliable; i.e. if the piped logging process is
1359
    killed, then it will not restart without a full server restart.</p>
1358
1360
1359
    <p>Using <code>syslog</code> instead of a filename enables logging
1361
    <p>Using <code>syslog</code> instead of a filename enables logging
1360
    via syslogd(8) if the system supports it and if <module>mod_syslog</module>
1362
    via syslogd(8) if the system supports it and if <module>mod_syslog</module>
(-)a/server/log.c (-15 / +29 lines)
Lines 306-328 static int open_error_log(server_rec *s, int is_main, apr_pool_t *p) Link Here
306
        apr_cmdtype_e cmdtype = APR_PROGRAM_ENV;
306
        apr_cmdtype_e cmdtype = APR_PROGRAM_ENV;
307
        fname = s->error_fname + 1;
307
        fname = s->error_fname + 1;
308
308
309
        /* In 2.4 favor PROGRAM_ENV, accept "||prog" syntax for compatibility
309
        if (is_main) {
310
         * and "|$cmd" to override the default.
310
            /* In 2.4 favor PROGRAM_ENV, accept "||prog" syntax for compatibility
311
         * Any 2.2 backport would continue to favor SHELLCMD_ENV so there
311
             * and "|$cmd" to override the default.
312
         * accept "||prog" to override, and "|$cmd" to ease conversion.
312
             * Any 2.2 backport would continue to favor SHELLCMD_ENV so there
313
         */
313
             * accept "||prog" to override, and "|$cmd" to ease conversion.
314
        if (*fname == '|')
314
             */
315
            ++fname;
315
            if (*fname == '|')
316
        if (*fname == '$') {
316
                ++fname;
317
            cmdtype = APR_SHELLCMD_ENV;
317
            if (*fname == '$') {
318
            ++fname;
318
                cmdtype = APR_SHELLCMD_ENV;
319
                ++fname;
320
            }
321
322
            /* If this is the main server_rec, the new child must use a dummy
323
             * stderr since the current stderr might be a pipe to the old
324
             * logger. Otherwise, the child inherits the parents stderr. This
325
             * has the unfortunate side effect of disabling reliable piped
326
             * logging for the main error log. */
327
            rc = log_child(p, fname, &dummy, cmdtype, is_main);
328
        } else {
329
            piped_log *pl = NULL;
330
331
            rc = APR_SUCCESS;
332
            pl = ap_open_piped_log(p, fname);
333
            if (pl == NULL || pl->write_fd == NULL) {
334
                /* no return code from open_piped_log()... */
335
                rc = APR_EGENERAL;
336
            }
337
            dummy = pl->write_fd;
319
        }
338
        }
320
339
321
        /* Spawn a new child logger.  If this is the main server_rec,
322
         * the new child must use a dummy stderr since the current
323
         * stderr might be a pipe to the old logger.  Otherwise, the
324
         * child inherits the parents stderr. */
325
        rc = log_child(p, fname, &dummy, cmdtype, is_main);
326
        if (rc != APR_SUCCESS) {
340
        if (rc != APR_SUCCESS) {
327
            ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, APLOGNO(00089)
341
            ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, APLOGNO(00089)
328
                         "Couldn't start ErrorLog process '%s'.",
342
                         "Couldn't start ErrorLog process '%s'.",

Return to bug 57742