On Sun, 2012-11-25 at 22:25 +0200, Tanu Kaskinen wrote: > So gnome-shell doesn't want to log to syslog? I've attached a pulseaudio > patch that makes gnome-shell log to files under /tmp. Btw, I now noticed > that running "gnome-shell --replace" restarts gnome-shell and makes the > log from the new instance go to the current terminal.
When I started my computer today, I found out that the patch causes a segfault during the gnome session startup, so X wouldn't come up. I've attached a fixed patch. Another note is that the patch doesn't work for the initial instance of gnome-shell. I'd guess that's because the "_" environment variable isn't set during the session startup. The patch should probably read the executable from /proc/self/cmdline rather than the "_" environment variable. I can do that change if necessary, but given that "gnome-shell --replace" works for getting the log anyway, maybe the whole patch is unnecessary. -- Tanu
>From 1decd84961a5dbc609cd688d881534011bbe11d3 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen <ta...@iki.fi> Date: Sun, 25 Nov 2012 21:41:39 +0200 Subject: [PATCH] Special logging configuration for gnome-shell --- src/pulsecore/log.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c index 8eaef54..8ed757b 100644 --- a/src/pulsecore/log.c +++ b/src/pulsecore/log.c @@ -29,6 +29,7 @@ #include <unistd.h> #include <string.h> #include <errno.h> +#include <fcntl.h> #ifdef HAVE_EXECINFO_H #include <execinfo.h> @@ -262,6 +263,30 @@ static void init_defaults(void) { if (getenv(ENV_LOG_NO_RATELIMIT)) no_rate_limit = TRUE; + if ((e = getenv("_")) && pa_streq(e, "/usr/bin/gnome-shell")) { + unsigned n; + int fd; + + for (n = 0; n < 20; n++) { + char *fn; + + fn = pa_sprintf_malloc("/tmp/gnome-shell-%u.txt", n); + fd = pa_open_cloexec(fn, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + pa_xfree(fn); + + if (fd >= 0 || errno != EEXIST) + break; + } + + if (fd >= 0) { + pa_log_set_fd(fd); + target_override = PA_LOG_FD; + target_override_set = true; + } + + maximum_level_override = PA_LOG_LEVEL_MAX-1; + flags_override = PA_LOG_PRINT_TIME | PA_LOG_PRINT_FILE | PA_LOG_PRINT_META | PA_LOG_PRINT_LEVEL; + } } PA_ONCE_END; } -- 1.7.10.4
_______________________________________________ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss