diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-03-25 00:33:43 +0100 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-03-25 00:33:43 +0100 |
| commit | 46f706319695dc77d66ab5f7cbc5cbdcad707366 (patch) | |
| tree | af8580044be2aac9066c034128ec52c3ce8d198f /src/plugins | |
| parent | b42449a7d77e649046a05ca82e2f6fa464bff3ca (diff) | |
| download | abrt-46f706319695dc77d66ab5f7cbc5cbdcad707366.tar.gz abrt-46f706319695dc77d66ab5f7cbc5cbdcad707366.tar.xz abrt-46f706319695dc77d66ab5f7cbc5cbdcad707366.zip | |
make $ABRT_PROG_PREFIX control whether log messages are prefixed
by abrt-action-foo programs.
abrtd, abrt-server and abrt-handle-crashdump now have option -p
which sets ABRT_PROG_PREFIX=1 for their children and thus makes
them emit program name prefixes.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/abrt-action-analyze-c.c | 20 | ||||
| -rw-r--r-- | src/plugins/abrt-action-analyze-oops.c | 20 | ||||
| -rw-r--r-- | src/plugins/abrt-action-analyze-python.c | 18 | ||||
| -rw-r--r-- | src/plugins/abrt-action-bugzilla.cpp | 25 | ||||
| -rw-r--r-- | src/plugins/abrt-action-generate-backtrace.c | 22 | ||||
| -rw-r--r-- | src/plugins/abrt-action-kerneloops.c | 25 | ||||
| -rw-r--r-- | src/plugins/abrt-action-mailx.c | 14 | ||||
| -rw-r--r-- | src/plugins/abrt-action-print.c | 7 | ||||
| -rw-r--r-- | src/plugins/abrt-action-rhtsupport.c | 25 | ||||
| -rw-r--r-- | src/plugins/abrt-action-upload.c | 14 |
10 files changed, 80 insertions, 110 deletions
diff --git a/src/plugins/abrt-action-analyze-c.c b/src/plugins/abrt-action-analyze-c.c index 635a3316..3c7d4f1d 100644 --- a/src/plugins/abrt-action-analyze-c.c +++ b/src/plugins/abrt-action-analyze-c.c @@ -153,31 +153,27 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-v] -d DIR\n\n" - "Calculates and saves UUID of coredumps" + PROGNAME" [-v] -d DIR\n" + "\n" + "Calculates and saves UUID of coredump in dump directory DIR" ); enum { OPT_v = 1 << 0, OPT_d = 1 << 1, -// OPT_s = 1 << 2, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Crash dump directory")), -// OPT_BOOL( 's', NULL, NULL, _("Log to syslog" )), + OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Dump directory")), OPT_END() }; /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - msg_prefix = PROGNAME; -//Maybe we will want this... later -// if (opts & OPT_s) -// { -// openlog(msg_prefix, 0, LOG_DAEMON); -// logmode = LOGMODE_SYSLOG; -// } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; /* Run unstrip -n and trim its output, leaving only sizes and build ids */ diff --git a/src/plugins/abrt-action-analyze-oops.c b/src/plugins/abrt-action-analyze-oops.c index 0072c71d..97a7cbf5 100644 --- a/src/plugins/abrt-action-analyze-oops.c +++ b/src/plugins/abrt-action-analyze-oops.c @@ -130,31 +130,27 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-vs] -d DIR\n\n" - "Calculates and saves UUID and DUPHASH of oops crash dumps" + PROGNAME" [-vs] -d DIR\n" + "\n" + "Calculates and saves UUID and DUPHASH for oops dump directory DIR" ); enum { OPT_v = 1 << 0, OPT_d = 1 << 1, -// OPT_s = 1 << 2, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Crash dump directory")), -// OPT_BOOL( 's', NULL, NULL, _("Log to syslog" )), + OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Dump directory")), OPT_END() }; /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - msg_prefix = PROGNAME; -//Maybe we will want this... later -// if (opts & OPT_s) -// { -// openlog(msg_prefix, 0, LOG_DAEMON); -// logmode = LOGMODE_SYSLOG; -// } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (!dd) diff --git a/src/plugins/abrt-action-analyze-python.c b/src/plugins/abrt-action-analyze-python.c index feffb439..44e2d4b8 100644 --- a/src/plugins/abrt-action-analyze-python.c +++ b/src/plugins/abrt-action-analyze-python.c @@ -35,31 +35,27 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-v] -d DIR\n\n" + PROGNAME" [-v] -d DIR\n" + "\n" "Calculates and saves UUID and DUPHASH of python crash dumps" ); enum { OPT_v = 1 << 0, OPT_d = 1 << 1, -// OPT_s = 1 << 2, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Crash dump directory")), -// OPT_BOOL( 's', NULL, NULL, _("Log to syslog" )), + OPT_STRING('d', NULL, &dump_dir_name, "DIR", _("Dump directory")), OPT_END() }; /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - msg_prefix = PROGNAME; -//Maybe we will want this... later -// if (opts & OPT_s) -// { -// openlog(msg_prefix, 0, LOG_DAEMON); -// logmode = LOGMODE_SYSLOG; -// } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (!dd) diff --git a/src/plugins/abrt-action-bugzilla.cpp b/src/plugins/abrt-action-bugzilla.cpp index 79e83b3b..abc3fa1a 100644 --- a/src/plugins/abrt-action-bugzilla.cpp +++ b/src/plugins/abrt-action-bugzilla.cpp @@ -908,34 +908,29 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-vs] -c CONFFILE -d DIR" + PROGNAME" [-v] -c CONFFILE -d DIR\n" "\n" - "\nReport a crash to Bugzilla" + "Reports problem to Bugzilla" ); enum { OPT_v = 1 << 0, - OPT_s = 1 << 1, - OPT_d = 1 << 2, - OPT_c = 1 << 3, + OPT_d = 1 << 1, + OPT_c = 1 << 2, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_BOOL( 's', NULL, NULL , _("Log to syslog")), - OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Crash dump directory")), + OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")), OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file (may be given many times)")), OPT_END() }; - unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); + /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); -//DONT! our stdout/stderr goes directly to daemon, don't want to have prefix there. -// msg_prefix = xasprintf(PROGNAME"[%u]", getpid()); - if (opts & OPT_s) - { - openlog(msg_prefix, 0, LOG_DAEMON); - logmode = LOGMODE_SYSLOG; - } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; while (conf_file) { diff --git a/src/plugins/abrt-action-generate-backtrace.c b/src/plugins/abrt-action-generate-backtrace.c index 7defc9c4..445a7b76 100644 --- a/src/plugins/abrt-action-generate-backtrace.c +++ b/src/plugins/abrt-action-generate-backtrace.c @@ -254,33 +254,31 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [options] -d DIR" + PROGNAME" [options] -d DIR\n" + "\n" + "Generates and saves backtrace for coredump in dump directory DIR" ); enum { OPT_v = 1 << 0, OPT_d = 1 << 1, OPT_i = 1 << 2, OPT_t = 1 << 3, - OPT_s = 1 << 4, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_STRING( 'd', NULL, &dump_dir_name , "DIR" , _("Crash dump directory")), - OPT_STRING( 'i', NULL, &i_opt , "dir1[:dir2]...", _("Additional debuginfo directories")), + OPT_STRING( 'd', NULL, &dump_dir_name , "DIR" , _("Dump directory")), + OPT_STRING( 'i', NULL, &i_opt , "DIR1[:DIR2]...", _("Additional debuginfo directories")), OPT_INTEGER('t', NULL, &exec_timeout_sec, _("Kill gdb if it runs for more than N seconds")), - OPT_BOOL( 's', NULL, NULL , _("Log to syslog")), OPT_END() }; - unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); + /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - //msg_prefix = PROGNAME; - if (opts & OPT_s) - { - openlog(msg_prefix, 0, LOG_DAEMON); - logmode = LOGMODE_SYSLOG; - } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; if (i_opt) { diff --git a/src/plugins/abrt-action-kerneloops.c b/src/plugins/abrt-action-kerneloops.c index fdcf4182..72ec80e3 100644 --- a/src/plugins/abrt-action-kerneloops.c +++ b/src/plugins/abrt-action-kerneloops.c @@ -130,34 +130,29 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-vs] -c CONFFILE -d DIR" + PROGNAME" [-v] -c CONFFILE -d DIR\n" "\n" - "\nReport a kernel oops to kerneloops.org (or similar) site" + "Reports kernel oops to kerneloops.org (or similar) site" ); enum { OPT_v = 1 << 0, - OPT_s = 1 << 1, - OPT_d = 1 << 2, - OPT_c = 1 << 3, + OPT_d = 1 << 1, + OPT_c = 1 << 2, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_BOOL( 's', NULL, NULL , _("Log to syslog")), - OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Crash dump directory")), + OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")), OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file (may be given many times)")), OPT_END() }; - unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); + /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); -//DONT! our stdout/stderr goes directly to daemon, don't want to have prefix there. -// msg_prefix = xasprintf(PROGNAME"[%u]", getpid()); - if (opts & OPT_s) - { - openlog(msg_prefix, 0, LOG_DAEMON); - logmode = LOGMODE_SYSLOG; - } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; while (conf_file) { diff --git a/src/plugins/abrt-action-mailx.c b/src/plugins/abrt-action-mailx.c index f9e82b04..dcea685b 100644 --- a/src/plugins/abrt-action-mailx.c +++ b/src/plugins/abrt-action-mailx.c @@ -134,7 +134,7 @@ int main(int argc, char **argv) const char *program_usage_string = _( PROGNAME" [-v] -d DIR [-c CONFFILE]\n" "\n" - "Upload compressed tarball of crash dump" + "Sends compressed tarball of dump directory DIR via email" ); enum { OPT_v = 1 << 0, @@ -144,19 +144,17 @@ int main(int argc, char **argv) /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Crash dump directory")), + OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")), OPT_STRING('c', NULL, &conf_file , "CONFFILE", _("Config file")), OPT_END() }; /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - //msg_prefix = PROGNAME; - //if (opts & OPT_s) - //{ - // openlog(msg_prefix, 0, LOG_DAEMON); - // logmode = LOGMODE_SYSLOG; - //} + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; map_string_h *settings = new_map_string(); if (conf_file) diff --git a/src/plugins/abrt-action-print.c b/src/plugins/abrt-action-print.c index f34fd014..be2179a5 100644 --- a/src/plugins/abrt-action-print.c +++ b/src/plugins/abrt-action-print.c @@ -38,7 +38,7 @@ int main(int argc, char **argv) const char *program_usage_string = _( PROGNAME" [-v] -d DIR [-o FILE] [-a yes/no]\n" "\n" - "Print problem information to standard output or FILE" + "Prints problem information to standard output or FILE" ); enum { OPT_v = 1 << 0, @@ -57,7 +57,10 @@ int main(int argc, char **argv) /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - //msg_prefix = PROGNAME; + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; if (output_file) { diff --git a/src/plugins/abrt-action-rhtsupport.c b/src/plugins/abrt-action-rhtsupport.c index 9175fdec..03274268 100644 --- a/src/plugins/abrt-action-rhtsupport.c +++ b/src/plugins/abrt-action-rhtsupport.c @@ -262,34 +262,29 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-vs] -c CONFFILE -d DIR" + PROGNAME" [-v] -c CONFFILE -d DIR\n" "\n" - "\nReport a crash to RHTSupport" + "Reports a problem to RHTSupport" ); enum { OPT_v = 1 << 0, - OPT_s = 1 << 1, - OPT_d = 1 << 2, - OPT_c = 1 << 3, + OPT_d = 1 << 1, + OPT_c = 1 << 2, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_BOOL( 's', NULL, NULL , _("Log to syslog")), - OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Crash dump directory")), + OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")), OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file (may be given many times)")), OPT_END() }; - unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); + /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); -//DONT! our stdout/stderr goes directly to daemon, don't want to have prefix there. -// msg_prefix = xasprintf(PROGNAME"[%u]", getpid()); - if (opts & OPT_s) - { - openlog(msg_prefix, 0, LOG_DAEMON); - logmode = LOGMODE_SYSLOG; - } + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; while (conf_file) { diff --git a/src/plugins/abrt-action-upload.c b/src/plugins/abrt-action-upload.c index 8556e142..beb09beb 100644 --- a/src/plugins/abrt-action-upload.c +++ b/src/plugins/abrt-action-upload.c @@ -245,7 +245,7 @@ int main(int argc, char **argv) const char *program_usage_string = _( PROGNAME" [-v] -d DIR [-c CONFFILE] [-u URL]\n" "\n" - "Upload compressed tarball of crash dump" + "Uploads compressed tarball of dump directory DIR" ); enum { OPT_v = 1 << 0, @@ -256,7 +256,7 @@ int main(int argc, char **argv) /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Crash dump directory")), + OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")), OPT_STRING('c', NULL, &conf_file , "CONFFILE", _("Config file")), OPT_STRING('u', NULL, &url , "URL" , _("Base URL to upload to")), OPT_END() @@ -264,12 +264,10 @@ int main(int argc, char **argv) /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); - //msg_prefix = PROGNAME; - //if (opts & OPT_s) - //{ - // openlog(msg_prefix, 0, LOG_DAEMON); - // logmode = LOGMODE_SYSLOG; - //} + + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; map_string_h *settings = new_map_string(); if (url) |
