log.c -- 看文档,还不如看代码来的简单。[8]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 liangbowen 的 blog

    va_list args;

    va_start(args, fmt);
    log_error_core(file, line, level, status, s, null, null, fmt, args);
    va_end(args);
}

ap_declare(void) ap_log_perror(const char *file, int line, int level,
                               apr_status_t status, apr_pool_t *p,
                               const char *fmt, ...)
{
    va_list args;

    va_start(args, fmt);
    log_error_core(file, line, level, status, null, null, p, fmt, args);
    va_end(args);
}

ap_declare(void) ap_log_rerror(const char *file, int line, int level,
                               apr_status_t status, const request_rec *r,
                               const char *fmt, ...)
{
    va_list args;

    va_start(args, fmt);
    log_error_core(file, line, level, status, r->server, r, null, fmt, args);

    /*
     * if aplog_toclient is set,
     * and 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.
     */
    va_end(args);
    va_start(args,fmt);
    if ((level & aplog_toclient)
        && ((level & aplog_levelmask) <= aplog_warning)
        && (apr_table_get(r->notes, "error-notes") == null)) {
        apr_table_setn(r->notes, "error-notes",
                       ap_escape_html(r->pool, apr_pvsprintf(r->pool, fmt,
                                                             args)));
    }
    va_end(args);
}

ap_declare(void) ap_log_pid(apr_pool_t *p, const char *filename)
{
    apr_file_t *pid_file = null;
    apr_finfo_t finfo;
    static pid_t saved_pid = -1;
    pid_t mypid;
    apr_status_t rv;
    const char *fname;

    if (!filename) {
        return;
    }

    fname = ap_server_root_relative(p, filename);
    if (!fname) {
        ap_log_error(aplog_mark, aplog_startup|aplog_crit, apr_ebadpath,
                     null, "invalid pid file path %s, ignoring.", filename);
        return;
    }

    mypid = getpid();
    if (mypid != saved_pid
        && apr_stat(&finfo, fname, apr_finfo_mtime, p) == apr_success) {
        /* ap_sig_graceful 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.
         */

本文关键:log.c -- 看文档,还不如看代码来的简单。
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top