On Fri, Dec 5, 2014 at 6:59 AM, Jan Kaluža <[email protected]> wrote:

> On 12/02/2014 02:08 PM, Jeff Trawick wrote:
>
>> On Wed, Sep 17, 2014 at 9:22 AM, Jeff Trawick <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     On Mon, Sep 15, 2014 at 2:00 AM, Jan Kaluža <[email protected]
>>     <mailto:[email protected]>> wrote:
>>
>>         On 09/14/2014 01:21 PM, Martynas Bendorius wrote:
>>
>>             Hello,
>>
>>             Is there any special reason why mod_systemd and mod_journald
>>             (available
>>             in trunk) are not backported to 2.4 yet?
>>
>>
>>         Hi,
>>
>>         I think mod_systemd could be proposed for 2.4 branch (maybe even
>>         with the changes adding socket activation), but for
>>         mod_journald, we would have to backport "modular logging", which
>>         breaks the API/ABI and therefore I'm afraid that won't happen in
>>         2.4 branch :(.
>>
>>
>>     I have an old patch somewhere that doesn't break the API/ABI, and
>>     accommodates such differences as syslog being built-in in 2.4.x.  I
>>     didn't realize that anybody besides me actually cared.
>>
>>     I'll try to find time to see how it fits in 2.4.x-HEAD.
>>
>>
>> I've simply attached it from its state one year ago, not having time to
>> play with it.  I don't think it is necessary to break the ABI.  syslog
>> support remains part of core logging instead of in a module.
>>
>
> I've created my version of the patch based on yours. It includes also more
> recent commits from trunk related to errorlog providers. Can you try it? I
> presume you have done that backport, because you are running that somewhere
> :).
>

Once upon a time...  What remains in my possession is a test module I wrote
for testing the interface (attached).

Anyway, is this feature from ap_errorlog_provider lost intentionally?

+    /** Checks syntax of ErrorLog directive argument.
+     * @param cmd The config directive
+     * @param arg ErrorLog directive argument (or the empty string if
+     * no argument was provided)
+     * @return Error message or NULL on success
+     * @remark The argument will be stored in the error_fname field
+     * of server_rec for access later.
+     */
+    const char * (*parse_errorlog_arg)(cmd_parms *cmd, const char *arg);

(and code to call it in set_errorlog)



> Regards,
> Jan Kaluza
>
>
>          Jan Kaluza
>>
>>
>>             As we have a lot of distributions already using systemd by
>>             default
>>             (CentOS/RHEL 7, Fedora, Arch Linux, CoreOS, openSUSE), and
>>             more of them
>>             are going to use systemd by default (Debian 8 (Jessie),
>>             Ubuntu), it
>>             requires manual patching of apache for the support of
>>             systemd/journald.
>>
>>             Thank you!
>>
>>


-- 
Born in Roswell... married an alien...
http://emptyhammock.com/
#include "apr_strings.h"

#include "ap_provider.h"
#include "http_core.h"
#include "http_log.h"

static void *elprov_error_log_init(apr_pool_t *p, server_rec *s)
{
    apr_file_t *f;
    apr_status_t rv;
    const char *basename = "logfile.txt";

    if (s->error_fname) {
        basename = apr_pstrcat(p, basename, ".", s->error_fname, NULL);
    }

    rv = apr_file_open(&f, 
                       apr_pstrcat(p,
                                   getenv("HOME"),
                                   "/",
                                   basename,
                                   NULL),
                       APR_WRITE | APR_APPEND | APR_CREATE,
                       APR_OS_DEFAULT, p);
    if (rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, s,
                     "mod_elprov: Error opening log file");
        return NULL;
    }

    return f;
}

static apr_status_t elprov_error_log(const ap_errorlog_info *info,
                                     void *handle, const char *errstr,
                                     apr_size_t len)
{
    return apr_file_write((apr_file_t *)handle, errstr, &len);
}

static const char *elprov_error_log_parse(cmd_parms *cmd, const char *arg)
{
    /* no configuration is valid */
    if (strlen(arg) 
        && (ap_strchr_c(arg, '/') || ap_strchr_c(arg, '\\'))) {
        return
          apr_pstrcat(cmd->pool,
                      "elprov error log provider does not accept args "
                      "which contain slashes (\"",
                      arg,
                      "\")",
                      NULL);
    }
    return NULL;
}

static ap_errorlog_provider elprov_provider = {
    elprov_error_log_init,
    elprov_error_log,
    elprov_error_log_parse,
    AP_ERRORLOG_PROVIDER_ADD_EOL_STR
};

static void elprov_register_hooks(apr_pool_t *p)
{
    ap_register_provider(p, AP_ERRORLOG_PROVIDER_GROUP, "elprov",
                         AP_ERRORLOG_PROVIDER_VERSION, &elprov_provider);
}

AP_DECLARE_MODULE(elprov) =
{
    STANDARD20_MODULE_STUFF,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    elprov_register_hooks,
};

Reply via email to