Branch oldpackages for 14.07
[14.07/packages.git] / multimedia / rygel / patches / 030-output-to-syslog.patch
1 Take all the output and send it to syslog.
2 This isn't great, but it's better than sending it to the bitbucket, at least
3 for troubleshooting.
4 --- a/src/rygel/rygel-log-handler.vala
5 +++ b/src/rygel/rygel-log-handler.vala
6 @@ -56,6 +56,29 @@
7      private LogHandler () {
8          this.log_level_hash = new HashMap<string,LogLevelFlags> ();
9  
10 +        string[] argv = { "/usr/bin/logger", "-t", "rygel" };
11 +        int logger_fd;
12 +
13 +        try {
14 +            GLib.Process.spawn_async_with_pipes (null,          // working_directory
15 +                                                 argv,
16 +                                                 null,          // envp
17 +                                                 SpawnFlags.STDOUT_TO_DEV_NULL |
18 +                                                 SpawnFlags.STDERR_TO_DEV_NULL,
19 +                                                 null,         // child_setup
20 +                                                 null,         // child_pid
21 +                                                 out logger_fd, // standard_input
22 +                                                 null,          // standard_output
23 +                                                 null);         // standard_error
24 +
25 +            Posix.dup2 (logger_fd, Posix.STDOUT_FILENO);
26 +            Posix.dup2 (logger_fd, Posix.STDERR_FILENO);
27 +            Posix.close (logger_fd);
28 +        } catch (Error err) {
29 +            warning (_("Unable to send output to /usr/bin/logger: %s"),
30 +                     err.message);
31 +        }
32 +
33          // Get the allowed log levels from the config
34          var config = MetaConfig.get_default ();
35          string log_levels;