[systemd-devel] [PATCH 1/2] Report about syntax error in extended format
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Mon Apr 1 22:33:45 PDT 2013
On Mon, Apr 01, 2013 at 10:17:04AM +0300, Oleksii Shevchuk wrote:
> ---
> src/shared/conf-parser.c | 86 ++++++++++++++++++++++++++++++------------------
> src/shared/conf-parser.h | 3 ++
> 2 files changed, 57 insertions(+), 32 deletions(-)
>
> diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
> index c2cf5a6..60a6b35 100644
> --- a/src/shared/conf-parser.c
> +++ b/src/shared/conf-parser.c
> @@ -35,6 +35,28 @@
> #include "set.h"
> #include "exit-status.h"
>
> +static int log_syntax(const char * file, unsigned line, bool error, const char *description, ...) {
> + _cleanup_free_ char *buf = NULL;
> +
> + va_list arg_descr, arg_copy;
> +
> + va_start(arg_descr, description);
> + va_copy(arg_copy, arg_descr);
> + if (vasprintf(&buf, description, arg_copy) < 0) {
> + va_end(arg_descr);
> + return log_oom();
> + }
> + va_end(arg_descr);
> +
> + return log_struct(error ? LOG_ERR : LOG_WARNING,
> + "MESSAGE=[%s:%d]: %s", file, line, buf,
> + "MESSAGE_ID=%s\n", error ? CONF_PARSER_ERROR : CONF_PARSER_WARNING,
> + "FILE=%s\n", file,
> + "LINE=%u\n", line,
> + "ERROR=%s\n", buf,
> + NULL);
Hi,
what we really need, is getting a proper SYSTEMD_UNIT tag
for those messages. Then they'll appear in systemctl output,
without further work.
The working assumption in systemd is that the journal is available,
can can be used. So it storing messages in systemd (patch 2/2) goes against
current design.
Also:
why not use one MESSAGE_ID? The messages are in the same format with the
same meaning, and their severity can be filtered separately.
FILE,LINE are about the *origin* of the message, so something
different should be used for the *object* (CONFIG_FILE,CONFIG_LINE?).
Zbyszek
More information about the systemd-devel
mailing list