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/daemon/Daemon.cpp | |
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/daemon/Daemon.cpp')
-rw-r--r-- | src/daemon/Daemon.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp index 7e19bcaf..5dd273e7 100644 --- a/src/daemon/Daemon.cpp +++ b/src/daemon/Daemon.cpp @@ -549,6 +549,7 @@ int main(int argc, char** argv) OPT_d = 1 << 1, OPT_s = 1 << 2, OPT_t = 1 << 3, + OPT_p = 1 << 4, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { @@ -556,12 +557,11 @@ int main(int argc, char** argv) OPT_BOOL( 'd', NULL, NULL , _("Do not daemonize")), OPT_BOOL( 's', NULL, NULL , _("Log to syslog even with -d")), OPT_INTEGER('t', NULL, &s_timeout, _("Exit after SEC seconds of inactivity")), + OPT_BOOL( 'p', NULL, NULL , _("Add program names to log")), OPT_END() }; unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); - unsetenv("ABRT_SYSLOG"); - putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); /* When dbus daemon starts us, it doesn't set PATH * (I saw it set only DBUS_STARTER_ADDRESS and DBUS_STARTER_BUS_TYPE). * In this case, set something sane: @@ -569,7 +569,12 @@ int main(int argc, char** argv) const char *env_path = getenv("PATH"); if (!env_path || !env_path[0]) putenv((char*)"PATH=/usr/sbin:/usr/bin:/sbin:/bin"); + + unsetenv("ABRT_SYSLOG"); + putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); msg_prefix = PROGNAME; /* for log(), error_msg() and such */ + if (opts & OPT_p) + putenv((char*)"ABRT_PROG_PREFIX=1"); if (opts & OPT_s) start_syslog_logging(); |