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

(-)modules/loggers/mod_log_config.c (-2 / +29 lines)
Lines 262-267 typedef struct { Link Here
262
    apr_array_header_t *format;
262
    apr_array_header_t *format;
263
    void *log_writer;
263
    void *log_writer;
264
    char *condition_var;
264
    char *condition_var;
265
    int inherit;
265
    ap_expr_info_t *condition_expr;
266
    ap_expr_info_t *condition_expr;
266
    /** place of definition or NULL if already checked */
267
    /** place of definition or NULL if already checked */
267
    const ap_directive_t *directive;
268
    const ap_directive_t *directive;
Lines 1171-1182 static int multi_log_transaction(request_rec *r) Link Here
1171
            config_log_transaction(r, cls, mls->default_format);
1172
            config_log_transaction(r, cls, mls->default_format);
1172
        }
1173
        }
1173
    }
1174
    }
1174
    else if (mls->server_config_logs) {
1175
1176
    if (mls->server_config_logs) {
1175
        clsarray = (config_log_state *) mls->server_config_logs->elts;
1177
        clsarray = (config_log_state *) mls->server_config_logs->elts;
1176
        for (i = 0; i < mls->server_config_logs->nelts; ++i) {
1178
        for (i = 0; i < mls->server_config_logs->nelts; ++i) {
1177
            config_log_state *cls = &clsarray[i];
1179
            config_log_state *cls = &clsarray[i];
1178
1180
1179
            config_log_transaction(r, cls, mls->default_format);
1181
            if(cls->inherit || !mls->config_logs->nelts) {
1182
                config_log_transaction(r, cls, mls->default_format);
1183
            }
1180
        }
1184
        }
1181
    }
1185
    }
1182
1186
Lines 1301-1306 static const char *add_custom_log(cmd_parms *cmd, void *dummy, const char *fn, Link Here
1301
    return err_string;
1305
    return err_string;
1302
}
1306
}
1303
1307
1308
static const char *add_global_log(cmd_parms *cmd, void *dummy, const char *fn,
1309
                                  const char *fmt, const char *envclause) {
1310
    multi_log_state *mls = ap_get_module_config(cmd->server->module_config,
1311
                                                &log_config_module);
1312
    config_log_state *clsarray;
1313
    config_log_state *cls;
1314
    const char *ret;
1315
1316
    /* Add a custom log through the normal channel */
1317
    ret = add_custom_log(cmd, dummy, fn, fmt, envclause);
1318
1319
    /* Set the inherit flag unless there was some error */
1320
    if (ret == NULL) {
1321
        clsarray = (config_log_state*)mls->config_logs->elts;
1322
        cls = &clsarray[mls->config_logs->nelts-1];
1323
        cls->inherit = 1;
1324
    }
1325
1326
    return ret;
1327
}
1328
1304
static const char *set_transfer_log(cmd_parms *cmd, void *dummy,
1329
static const char *set_transfer_log(cmd_parms *cmd, void *dummy,
1305
                                    const char *fn)
1330
                                    const char *fn)
1306
{
1331
{
Lines 1325-1330 static const command_rec config_log_cmds[] = Link Here
1325
AP_INIT_TAKE23("CustomLog", add_custom_log, NULL, RSRC_CONF,
1350
AP_INIT_TAKE23("CustomLog", add_custom_log, NULL, RSRC_CONF,
1326
     "a file name, a custom log format string or format name, "
1351
     "a file name, a custom log format string or format name, "
1327
     "and an optional \"env=\" or \"expr=\" clause (see docs)"),
1352
     "and an optional \"env=\" or \"expr=\" clause (see docs)"),
1353
AP_INIT_TAKE23("GlobalLog", add_global_log, NULL, RSRC_CONF,
1354
     "Same as CustomLog, but forces virtualhosts to inherit the log"),
1328
AP_INIT_TAKE1("TransferLog", set_transfer_log, NULL, RSRC_CONF,
1355
AP_INIT_TAKE1("TransferLog", set_transfer_log, NULL, RSRC_CONF,
1329
     "the filename of the access log"),
1356
     "the filename of the access log"),
1330
AP_INIT_TAKE12("LogFormat", log_format, NULL, RSRC_CONF,
1357
AP_INIT_TAKE12("LogFormat", log_format, NULL, RSRC_CONF,

Return to bug 56517