Merge lp:~rhansen/lightdm/multiseat-logging into lp:lightdm

Proposed by Richard Hansen on 2013-08-05
Status: Superseded
Proposed branch: lp:~rhansen/lightdm/multiseat-logging
Merge into: lp:lightdm
Prerequisite: lp:~rhansen/lightdm/seatunity-call-parent
Diff against target: 1838 lines (+507/-167)
17 files modified
src/Makefile.am (+2/-0)
src/display-server.c (+19/-1)
src/display-server.h (+1/-0)
src/greeter.c (+43/-27)
src/lightdm.c (+7/-1)
src/logger.c (+85/-0)
src/logger.h (+64/-0)
src/seat-unity.c (+47/-25)
src/seat-xlocal.c (+16/-7)
src/seat-xremote.c (+12/-4)
src/seat.c (+108/-61)
src/seat.h (+1/-0)
src/session.c (+48/-17)
src/session.h (+1/-0)
src/x-server-local.c (+23/-11)
src/x-server-xvnc.c (+24/-11)
src/x-server.c (+6/-2)
To merge this branch: bzr merge lp:~rhansen/lightdm/multiseat-logging
Reviewer Review Type Date Requested Status
Robert Ancell 2013-08-05 Needs Fixing on 2013-08-13
Review via email: mp+178510@code.launchpad.net

This proposal has been superseded by a proposal from 2013-08-14.

Description of the change

Extend logging to make it easier to troubleshoot multiseat setups:
  * include seat name in Seat log messages
  * include display server name in DisplayServer log messages
  * include PID in Session log messages
  * log the values of the XDG_SEAT and XDG_VTNR PAM variables

To post a comment you must log in.
Robert Ancell (robert-ancell) wrote :

Nice work!

There seems to be no default value set for seats, i.e. if you do:
$ cd tests
$ DEBUG=1 ./test-autologin

you get logs like:

[+0.00s] DEBUG: Seat (null): Creating user session

If the ID is NULL, id expect to see:

[+0.00s] DEBUG: Seat: Creating user session

or at least a valid ID.

You don't need to break at 80 characters, I've fixed the whitespace in this branch:
lp:~robert-ancell/lightdm/multiseat-logging-whitespace
(I suggest you manually patch to keep the attribution to you for the changes).

Also, now the logging is better, we have some redundant text.

[+0.00s] DEBUG: Seat (null): Starting seat

should become

[+0.00s] DEBUG: Seat (null): Starting

Though I wont block this merge on this. We can fix this in a later MP if you like.

review: Needs Fixing
Richard Hansen (rhansen) wrote :

> There seems to be no default value set for seats, i.e. if you do:
> $ cd tests
> $ DEBUG=1 ./test-autologin
>
> you get logs like:
>
> [+0.00s] DEBUG: Seat (null): Creating user session
>
> If the ID is NULL, id expect to see:
>
> [+0.00s] DEBUG: Seat: Creating user session
>
> or at least a valid ID.

OK, I'll see what I can do to improve it.

>
> You don't need to break at 80 characters

I really dislike lines longer than 80 characters, which is why I
usually wrap long lines when I change them. I'll unwrap, but I'll
feel like I'm violating my own principles. :)

See [1] for why don't I like lines longer than 80 characters.

[1] http://stackoverflow.com/a/111009/712605

>
> Also, now the logging is better, we have some redundant text.
>
> [+0.00s] DEBUG: Seat (null): Starting seat
>
> should become
>
> [+0.00s] DEBUG: Seat (null): Starting
>
> Though I wont block this merge on this. We can fix this in a later
> MP if you like.

I caught some of those (e.g., "starting session with PID=xxx"), but it
looks like I missed some. I'll do an audit.

Unmerged revisions

1762. By Richard Hansen on 2013-08-04

log the values of the XDG_SEAT and XDG_VTNR variables

This makes it easier to debug multiseat setups.

1761. By Richard Hansen on 2013-08-04

delay setting Session pid to 0 (for logging)

The Session pid is currently used in Session log messages. Delay
setting it to 0 so that more log messages have a meaningful prefix (to
make it possible to correlate them with other log messages).

1760. By Richard Hansen on 2013-08-04

add session PID to Session (including Greeter) log messages

This makes it easier to debug multiseat setups.

1759. By Richard Hansen on 2013-08-04

have Session implement the Logger interface

This is a step toward logging the session PID in each Session
log message, which will make it easier to debug multiseat setups.

The PID is set to 0 when the Session process terminates, so it is not
possible to follow a Session's complete lifetime in the logs. But
it's better than nothing.

A future commit could easily change this to log some other identifier,
such as the associated Display or Seat name, or the PID before the
process terminated.

1758. By Richard Hansen on 2013-08-04

add display server name to DisplayServer log messages

This makes it easier to debug multiseat setups.

1757. By Richard Hansen on 2013-08-04

have DisplayServer implement the Logger interface

This is a step toward logging the display server name in each
DisplayServer log message, which will make it easier to debug
multiseat setups.

1756. By Richard Hansen on 2013-08-04

add seat name to Seat log messages

This makes it easier to debug multiseat setups.

1755. By Richard Hansen on 2013-08-04

have Seat implement the Logger interface

This is a step toward logging the seat name in each Seat log message,
which will make it easier to debug multiseat setups.

1754. By Richard Hansen on 2013-08-04

make the Seat available everywhere a log message is generated

This will make it possible to prefix the log messages with the Seat's
name.

1753. By Richard Hansen on 2013-08-04

save the Seat name when parsing the config file

This will be used to prefix each Seat log message with the seat name.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Makefile.am'
2--- src/Makefile.am 2013-07-24 23:53:37 +0000
3+++ src/Makefile.am 2013-08-05 07:39:31 +0000
4@@ -18,6 +18,8 @@
5 guest-account.c \
6 guest-account.h \
7 lightdm.c \
8+ logger.c \
9+ logger.h \
10 login1.c \
11 login1.h \
12 mir-server.c \
13
14=== modified file 'src/display-server.c'
15--- src/display-server.c 2013-07-26 04:50:35 +0000
16+++ src/display-server.c 2013-08-05 07:39:31 +0000
17@@ -32,7 +32,11 @@
18 gboolean stopped;
19 };
20
21-G_DEFINE_TYPE (DisplayServer, display_server, G_TYPE_OBJECT);
22+static void display_server_logger_iface_init (LoggerInterface *iface);
23+
24+G_DEFINE_TYPE_WITH_CODE (DisplayServer, display_server, G_TYPE_OBJECT,
25+ G_IMPLEMENT_INTERFACE (
26+ LOGGER_TYPE, display_server_logger_iface_init));
27
28 void
29 display_server_set_name (DisplayServer *server, const gchar *name)
30@@ -176,3 +180,17 @@
31 NULL,
32 G_TYPE_NONE, 0);
33 }
34+
35+static gint
36+display_server_real_logprefix (Logger *self, gchar *buf, gulong buflen)
37+{
38+ DisplayServer *server = DISPLAY_SERVER (self);
39+ return g_snprintf (buf, buflen, "DisplayServer %s: ",
40+ display_server_get_name (server));
41+}
42+
43+static void
44+display_server_logger_iface_init (LoggerInterface *iface)
45+{
46+ iface->logprefix = &display_server_real_logprefix;
47+}
48
49=== modified file 'src/display-server.h'
50--- src/display-server.h 2013-07-26 02:54:55 +0000
51+++ src/display-server.h 2013-08-05 07:39:31 +0000
52@@ -16,6 +16,7 @@
53
54 typedef struct DisplayServer DisplayServer;
55
56+#include "logger.h"
57 #include "session.h"
58
59 G_BEGIN_DECLS
60
61=== modified file 'src/greeter.c'
62--- src/greeter.c 2013-07-24 23:53:37 +0000
63+++ src/greeter.c 2013-08-05 07:39:31 +0000
64@@ -164,7 +164,7 @@
65
66 g_io_channel_write_chars (greeter->priv->to_greeter_channel, (gchar *) message, message_length, NULL, &error);
67 if (error)
68- g_warning ("Error writing to greeter: %s", error->message);
69+ l_warning (greeter, "Error writing to greeter: %s", error->message);
70 g_clear_error (&error);
71 g_io_channel_flush (greeter->priv->to_greeter_channel, NULL);
72 }
73@@ -225,7 +225,7 @@
74 GHashTableIter iter;
75 gpointer key, value;
76
77- g_debug ("Greeter connected version=%s", version);
78+ l_debug (greeter, "Greeter connected version=%s", version);
79
80 length = string_length (VERSION);
81 g_hash_table_iter_init (&iter, greeter->priv->hints);
82@@ -260,7 +260,7 @@
83 messages_length = session_get_messages_length (session);
84
85 /* Respond to d-bus query with messages */
86- g_debug ("Prompt greeter with %d message(s)", messages_length);
87+ l_debug (greeter, "Prompt greeter with %d message(s)", messages_length);
88 size = int_length () + string_length (session_get_username (session)) + int_length ();
89 for (i = 0; i < messages_length; i++)
90 size += int_length () + string_length (messages[i].msg);
91@@ -308,16 +308,21 @@
92 {
93 int result;
94
95- g_debug ("Authenticate result for user %s: %s", session_get_username (session), session_get_authentication_result_string (session));
96+ l_debug (greeter,
97+ "Authenticate result for user %s: %s", session_get_username (session),
98+ session_get_authentication_result_string (session));
99
100 result = session_get_authentication_result (session);
101 if (session_get_is_authenticated (session))
102 {
103 if (session_get_user (session))
104- g_debug ("User %s authorized", session_get_username (session));
105+ l_debug (greeter,
106+ "User %s authorized", session_get_username (session));
107 else
108 {
109- g_debug ("User %s authorized, but no account of that name exists", session_get_username (session));
110+ l_debug (greeter,
111+ "User %s authorized, but no account of that name exists",
112+ session_get_username (session));
113 result = PAM_USER_UNKNOWN;
114 }
115 }
116@@ -349,11 +354,11 @@
117
118 if (username[0] == '\0')
119 {
120- g_debug ("Greeter start authentication");
121+ l_debug (greeter, "Greeter start authentication");
122 username = NULL;
123 }
124 else
125- g_debug ("Greeter start authentication for %s", username);
126+ l_debug (greeter, "Greeter start authentication for %s", username);
127
128 reset_session (greeter);
129
130@@ -392,13 +397,13 @@
131 static void
132 handle_login_as_guest (Greeter *greeter, guint32 sequence_number)
133 {
134- g_debug ("Greeter start authentication for guest account");
135+ l_debug (greeter, "Greeter start authentication for guest account");
136
137 reset_session (greeter);
138
139 if (!greeter->priv->allow_guest)
140 {
141- g_debug ("Guest account is disabled");
142+ l_debug (greeter, "Guest account is disabled");
143 send_end_authentication (greeter, sequence_number, "", PAM_USER_UNKNOWN);
144 return;
145 }
146@@ -449,11 +454,14 @@
147
148 if (username[0] == '\0')
149 {
150- g_debug ("Greeter start authentication for remote session %s", session_name);
151+ l_debug (greeter,
152+ "Greeter start authentication for remote session %s", session_name);
153 username = NULL;
154 }
155 else
156- g_debug ("Greeter start authentication for remote session %s as user %s", session_name, username);
157+ l_debug (greeter,
158+ "Greeter start authentication for remote session %s as user %s",
159+ session_name, username);
160
161 reset_session (greeter);
162
163@@ -518,7 +526,7 @@
164 return;
165 }
166
167- g_debug ("Continue authentication");
168+ l_debug (greeter, "Continue authentication");
169
170 /* Build response */
171 response = calloc (messages_length, sizeof (struct pam_response));
172@@ -548,7 +556,7 @@
173 if (greeter->priv->authentication_session == NULL)
174 return;
175
176- g_debug ("Cancel authentication");
177+ l_debug (greeter, "Cancel authentication");
178 reset_session (greeter);
179 }
180
181@@ -573,15 +581,16 @@
182 if (greeter->priv->guest_account_authenticated || session_get_is_authenticated (greeter->priv->authentication_session))
183 {
184 if (session)
185- g_debug ("Greeter requests session %s", session);
186+ l_debug (greeter, "Greeter requests session %s", session);
187 else
188- g_debug ("Greeter requests default session");
189+ l_debug (greeter, "Greeter requests default session");
190 greeter->priv->start_session = TRUE;
191 g_signal_emit (greeter, signals[START_SESSION], 0, session_type, session, &result);
192 }
193 else
194 {
195- g_debug ("Ignoring start session request, user is not authorized");
196+ l_debug (greeter,
197+ "Ignoring start session request, user is not authorized");
198 result = FALSE;
199 }
200
201@@ -597,18 +606,19 @@
202
203 if (!greeter->priv->guest_account_authenticated && !session_get_is_authenticated (greeter->priv->authentication_session))
204 {
205- g_debug ("Ignoring set language request, user is not authorized");
206+ l_debug (greeter,
207+ "Ignoring set language request, user is not authorized");
208 return;
209 }
210
211 // FIXME: Could use this
212 if (greeter->priv->guest_account_authenticated)
213 {
214- g_debug ("Ignoring set language request for guest user");
215+ l_debug (greeter, "Ignoring set language request for guest user");
216 return;
217 }
218
219- g_debug ("Greeter sets language %s", language);
220+ l_debug (greeter, "Greeter sets language %s", language);
221 user = session_get_user (greeter->priv->authentication_session);
222 user_set_language (user, language);
223 }
224@@ -620,7 +630,9 @@
225 guint8 *buffer;
226 if (greeter->priv->n_read - *offset < sizeof (guint32))
227 {
228- g_warning ("Not enough space for int, need %zu, got %zu", sizeof (guint32), greeter->priv->n_read - *offset);
229+ l_warning (greeter,
230+ "Not enough space for int, need %zu, got %zu",
231+ sizeof (guint32), greeter->priv->n_read - *offset);
232 return 0;
233 }
234 buffer = greeter->priv->read_buffer + *offset;
235@@ -640,7 +652,8 @@
236
237 if (HEADER_SIZE + payload_length < HEADER_SIZE)
238 {
239- g_warning ("Payload length of %u octets too long", payload_length);
240+ l_warning (greeter,
241+ "Payload length of %u octets too long", payload_length);
242 return HEADER_SIZE;
243 }
244
245@@ -656,7 +669,9 @@
246 length = read_int (greeter, offset);
247 if (greeter->priv->n_read - *offset < length)
248 {
249- g_warning ("Not enough space for string, need %u, got %zu", length, greeter->priv->n_read - *offset);
250+ l_warning (greeter,
251+ "Not enough space for string, need %u, got %zu",
252+ length, greeter->priv->n_read - *offset);
253 return g_strdup ("");
254 }
255
256@@ -697,7 +712,7 @@
257
258 if (condition == G_IO_HUP)
259 {
260- g_debug ("Greeter closed communication channel");
261+ l_debug (greeter, "Greeter closed communication channel");
262 return FALSE;
263 }
264
265@@ -715,7 +730,7 @@
266 &n_read,
267 &error);
268 if (error)
269- g_warning ("Error reading from greeter: %s", error->message);
270+ l_warning (greeter, "Error reading from greeter: %s", error->message);
271 g_clear_error (&error);
272 if (status != G_IO_STATUS_NORMAL)
273 return TRUE;
274@@ -767,7 +782,8 @@
275 max_secrets = (G_MAXUINT32 - 1) / sizeof (gchar *);
276 if (n_secrets > max_secrets)
277 {
278- g_warning ("Array length of %u elements too long", n_secrets);
279+ l_warning (greeter,
280+ "Array length of %u elements too long", n_secrets);
281 return FALSE;
282 }
283 secrets = g_malloc (sizeof (gchar *) * (n_secrets + 1));
284@@ -793,7 +809,7 @@
285 g_free (language);
286 break;
287 default:
288- g_warning ("Unknown message from greeter: %d", id);
289+ l_warning (greeter, "Unknown message from greeter: %d", id);
290 break;
291 }
292
293
294=== modified file 'src/lightdm.c'
295--- src/lightdm.c 2013-07-24 03:02:30 +0000
296+++ src/lightdm.c 2013-08-05 07:39:31 +0000
297@@ -1168,8 +1168,9 @@
298 gchar *config_section = *i;
299 gchar *type;
300 Seat *seat;
301+ const gchar *const seatpfx = "Seat:";
302
303- if (!g_str_has_prefix (config_section, "Seat:"))
304+ if (!g_str_has_prefix (config_section, seatpfx))
305 continue;
306
307 g_debug ("Loading seat %s", config_section);
308@@ -1180,6 +1181,11 @@
309 g_free (type);
310 if (seat)
311 {
312+ const gsize seatpfxlen = strlen(seatpfx);
313+ gchar *seatname = config_section + seatpfxlen;
314+
315+ seat_set_property (seat, "seat-name", seatname);
316+
317 set_seat_properties (seat, config_section);
318 display_manager_add_seat (display_manager, seat);
319 g_object_unref (seat);
320
321=== added file 'src/logger.c'
322--- src/logger.c 1970-01-01 00:00:00 +0000
323+++ src/logger.c 2013-08-05 07:39:31 +0000
324@@ -0,0 +1,85 @@
325+#include "logger.h"
326+
327+G_DEFINE_INTERFACE (Logger, logger, G_TYPE_INVALID);
328+
329+static void
330+logger_logv_default (Logger *self, GLogLevelFlags log_level,
331+ const gchar *format, va_list ap);
332+
333+static void
334+logger_default_init (LoggerInterface *iface)
335+{
336+ iface->logv = &logger_logv_default;
337+}
338+
339+gint
340+logger_logprefix (Logger *self, gchar *buf, gulong buflen)
341+{
342+ g_return_val_if_fail (IS_LOGGER (self), -1);
343+ return LOGGER_GET_INTERFACE (self)->logprefix (self, buf, buflen);
344+}
345+
346+void
347+logger_logv (Logger *self, GLogLevelFlags log_level,
348+ const gchar *format, va_list ap)
349+{
350+ g_return_if_fail (IS_LOGGER (self));
351+ LOGGER_GET_INTERFACE (self)->logv (self, log_level, format, ap);
352+}
353+
354+void
355+logger_logv_default (Logger *self, GLogLevelFlags log_level,
356+ const gchar *format, va_list ap)
357+{
358+ va_list ap_copy;
359+ gint tmp;
360+
361+ /* figure out how long the prefix is */
362+ tmp = logger_logprefix (self, NULL, 0);
363+ if (tmp < 0)
364+ {
365+ g_error ("failed to get log prefix");
366+ return;
367+ }
368+
369+ /* print the prefix to a variable length array (to avoid malloc) */
370+ gchar pfx[tmp + 1];
371+ tmp = logger_logprefix (self, pfx, sizeof(pfx));
372+ if (tmp < 0)
373+ {
374+ g_error ("failed to get log prefix");
375+ return;
376+ }
377+
378+ /* figure out how long the formatted message is */
379+ va_copy (ap_copy, ap);
380+ tmp = g_vsnprintf (NULL, 0, format, ap_copy);
381+ va_end (ap_copy);
382+ if (tmp < 0)
383+ {
384+ g_error ("failed to format log message");
385+ return;
386+ }
387+
388+ /* print the message to a variable length array (to avoid malloc) */
389+ gchar msg[tmp+1];
390+ tmp = g_vsnprintf (msg, sizeof(msg), format, ap);
391+ if (tmp < 0)
392+ {
393+ g_error ("failed to format log message");
394+ return;
395+ }
396+
397+ /* log the message with the prefix */
398+ g_log (G_LOG_DOMAIN, log_level, "%s%s", pfx, msg);
399+}
400+
401+void
402+logger_log (Logger *self, GLogLevelFlags log_level,
403+ const gchar *format, ...)
404+{
405+ va_list ap;
406+ va_start (ap, format);
407+ logger_logv (self, log_level, format, ap);
408+ va_end (ap);
409+}
410
411=== added file 'src/logger.h'
412--- src/logger.h 1970-01-01 00:00:00 +0000
413+++ src/logger.h 2013-08-05 07:39:31 +0000
414@@ -0,0 +1,64 @@
415+#ifndef LOGGER_H_
416+#define LOGGER_H_
417+
418+#include <glib-object.h>
419+
420+#ifdef __cplusplus
421+#include <cstdarg> /* for va_list */
422+#else
423+#include <stdarg.h> /* for va_list */
424+#endif
425+
426+G_BEGIN_DECLS
427+
428+#define LOGGER_TYPE (logger_get_type ())
429+#define LOGGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOGGER_TYPE, Logger))
430+#define IS_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOGGER_TYPE))
431+#define LOGGER_GET_INTERFACE(obj) \
432+ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), LOGGER_TYPE, LoggerInterface))
433+
434+typedef struct Logger Logger;
435+
436+typedef struct {
437+ GTypeInterface parent;
438+
439+ gint (*logprefix) (Logger *self, gchar *buf, gulong buflen);
440+ void (*logv) (Logger *self, GLogLevelFlags log_level,
441+ const gchar *format, va_list ap);
442+} LoggerInterface;
443+
444+GType logger_get_type (void);
445+
446+/*!
447+ * \brief instruct \c self to generate a log message prefix
448+ *
449+ * the semantics of the \c buf and \c buflen arguments and the return
450+ * value are the same as g_snprintf()
451+ *
452+ * there is no default implementation
453+ */
454+gint logger_logprefix (Logger *self, gchar *buf, gulong buflen);
455+
456+/*!
457+ * \brief instruct \c self to log the given message
458+ *
459+ * the default implementation prefixes the log message with the
460+ * output of logger_logprefix() and then passes the result to
461+ * g_log()
462+ */
463+void logger_logv (Logger *self, GLogLevelFlags log_level,
464+ const gchar *format, va_list ap);
465+
466+/*! \brief convenience wrapper around \c logger_logv() */
467+void logger_log (Logger *self, GLogLevelFlags log_level,
468+ const gchar *format, ...);
469+
470+/* convenience wrappers around logger_log() */
471+#define l_debug(self, ...) \
472+ logger_log (LOGGER (self), G_LOG_LEVEL_DEBUG, __VA_ARGS__)
473+#define l_warning(self, ...) \
474+ logger_log (LOGGER (self), G_LOG_LEVEL_WARNING, __VA_ARGS__)
475+
476+G_END_DECLS
477+
478+#endif /* !LOGGER_H_ */
479
480=== modified file 'src/seat-unity.c'
481--- src/seat-unity.c 2013-08-05 07:39:31 +0000
482+++ src/seat-unity.c 2013-08-05 07:39:31 +0000
483@@ -108,13 +108,13 @@
484 /* If stopped before it was ready, then revert to VT mode */
485 if (!seat->priv->compositor_ready)
486 {
487- g_debug ("Compositor failed to start, switching to VT mode");
488+ l_debug (seat, "Compositor failed to start, switching to VT mode");
489 seat->priv->use_vt_switching = TRUE;
490 SEAT_CLASS (seat_unity_parent_class)->start (SEAT (seat));
491 return;
492 }
493
494- g_debug ("Stopping Unity seat, compositor terminated");
495+ l_debug (seat, "Stopping Unity seat, compositor terminated");
496
497 seat_stop (SEAT (seat));
498 }
499@@ -136,7 +136,9 @@
500
501 fd = g_open (seat->priv->log_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
502 if (fd < 0)
503- g_warning ("Failed to open log file %s: %s", seat->priv->log_file, g_strerror (errno));
504+ l_warning (seat,
505+ "Failed to open log file %s: %s",
506+ seat->priv->log_file, g_strerror (errno));
507 else
508 {
509 dup2 (fd, STDOUT_FILENO);
510@@ -161,7 +163,7 @@
511
512 errno = 0;
513 if (write (seat->priv->to_compositor_pipe[1], data, data_length) != data_length)
514- g_warning ("Failed to write to compositor: %s", strerror (errno));
515+ l_warning (seat, "Failed to write to compositor: %s", strerror (errno));
516 }
517
518 static gboolean
519@@ -174,7 +176,7 @@
520
521 if (condition == G_IO_HUP)
522 {
523- g_debug ("Compositor closed communication channel");
524+ l_debug (seat, "Compositor closed communication channel");
525 return FALSE;
526 }
527
528@@ -204,7 +206,8 @@
529 &n_read,
530 &error);
531 if (error)
532- g_warning ("Failed to read from compositor: %s", error->message);
533+ l_warning (seat,
534+ "Failed to read from compositor: %s", error->message);
535 if (status != G_IO_STATUS_NORMAL)
536 return TRUE;
537 g_clear_error (&error);
538@@ -225,28 +228,30 @@
539 switch (id)
540 {
541 case USC_MESSAGE_PING:
542- g_debug ("PING!");
543+ l_debug (seat, "PING!");
544 write_message (seat, USC_MESSAGE_PONG, NULL, 0);
545 break;
546 case USC_MESSAGE_PONG:
547- g_debug ("PONG!");
548+ l_debug (seat, "PONG!");
549 break;
550 case USC_MESSAGE_READY:
551- g_debug ("READY");
552+ l_debug (seat, "READY");
553 if (!seat->priv->compositor_ready)
554 {
555 seat->priv->compositor_ready = TRUE;
556- g_debug ("Compositor ready");
557+ l_debug (seat, "Compositor ready");
558 g_source_remove (seat->priv->compositor_timeout);
559 seat->priv->compositor_timeout = 0;
560 SEAT_CLASS (seat_unity_parent_class)->start (SEAT (seat));
561 }
562 break;
563 case USC_MESSAGE_SESSION_CONNECTED:
564- g_debug ("SESSION CONNECTED");
565+ l_debug (seat, "SESSION CONNECTED");
566 break;
567 default:
568- g_warning ("Ingoring unknown message %d with %d octets from system compositor", id, payload_length);
569+ l_warning (seat,
570+ "Ignoring unknown message %d with %d octets from system compositor",
571+ id, payload_length);
572 break;
573 }
574
575@@ -310,7 +315,10 @@
576 plymouth_quit (TRUE);
577 }
578 else
579- g_debug ("Plymouth is running on VT %d, but this is less than the configured minimum of %d so not replacing it", active_vt, vt_get_min ());
580+ l_debug (seat,
581+ "Plymouth is running on VT %d,"
582+ " but this is less than the configured minimum of %d"
583+ " so not replacing it", active_vt, vt_get_min ());
584 }
585 if (plymouth_get_is_active ())
586 plymouth_quit (FALSE);
587@@ -318,7 +326,7 @@
588 SEAT_UNITY (seat)->priv->vt = vt_get_unused ();
589 if (SEAT_UNITY (seat)->priv->vt < 0)
590 {
591- g_debug ("Failed to get a VT to run on");
592+ l_debug (seat, "Failed to get a VT to run on");
593 return FALSE;
594 }
595 vt_ref (SEAT_UNITY (seat)->priv->vt);
596@@ -326,7 +334,8 @@
597 /* Create pipes to talk to compositor */
598 if (pipe (SEAT_UNITY (seat)->priv->to_compositor_pipe) < 0 || pipe (SEAT_UNITY (seat)->priv->from_compositor_pipe) < 0)
599 {
600- g_debug ("Failed to create compositor pipes: %s", g_strerror (errno));
601+ l_debug (seat,
602+ "Failed to create compositor pipes: %s", g_strerror (errno));
603 return FALSE;
604 }
605
606@@ -341,7 +350,7 @@
607 /* Setup logging */
608 dir = config_get_string (config_get_instance (), "LightDM", "log-directory");
609 SEAT_UNITY (seat)->priv->log_file = g_build_filename (dir, "unity-system-compositor.log", NULL);
610- g_debug ("Logging to %s", SEAT_UNITY (seat)->priv->log_file);
611+ l_debug (seat, "Logging to %s", SEAT_UNITY (seat)->priv->log_file);
612 g_free (dir);
613
614 SEAT_UNITY (seat)->priv->mir_socket_filename = g_strdup ("/tmp/mir_socket"); // FIXME: Use this socket by default as XMir is hardcoded to this
615@@ -372,7 +381,7 @@
616 timeout = seat_get_integer_property (seat, "unity-compositor-timeout");
617 if (timeout <= 0)
618 timeout = 60;
619- g_debug ("Waiting for system compositor for %ds", timeout);
620+ l_debug (seat, "Waiting for system compositor for %ds", timeout);
621 SEAT_UNITY (seat)->priv->compositor_timeout = g_timeout_add (timeout * 1000, compositor_timeout_cb, seat);
622
623 return TRUE;
624@@ -386,7 +395,7 @@
625 gboolean allow_tcp;
626 gint port = 0;
627
628- g_debug ("Starting X server on Unity compositor");
629+ l_debug (seat, "Starting X server on Unity compositor");
630
631 x_server = x_server_local_new ();
632
633@@ -441,7 +450,7 @@
634 keys = g_key_file_new ();
635 result = g_key_file_load_from_file (keys, path, G_KEY_FILE_NONE, &error);
636 if (error)
637- g_debug ("Error getting key %s", error->message);
638+ l_debug (seat, "Error getting key %s", error->message);
639 g_clear_error (&error);
640
641 if (result)
642@@ -451,7 +460,7 @@
643 if (g_key_file_has_key (keys, "keyring", key_name, NULL))
644 key = g_key_file_get_string (keys, "keyring", key_name, NULL);
645 else
646- g_debug ("Key %s not defined", key_name);
647+ l_debug (seat, "Key %s not defined", key_name);
648
649 if (key)
650 x_server_local_set_xdmcp_key (x_server, key);
651@@ -498,7 +507,8 @@
652 return create_mir_server (seat);
653 else
654 {
655- g_warning ("Can't create unsupported display server '%s'", session_type);
656+ l_warning (seat,
657+ "Can't create unsupported display server '%s'", session_type);
658 return NULL;
659 }
660 }
661@@ -507,16 +517,22 @@
662 seat_unity_create_greeter_session (Seat *seat)
663 {
664 Greeter *greeter_session;
665+ const gchar *xdg_seat;
666
667 greeter_session =
668 SEAT_CLASS (seat_unity_parent_class)->create_greeter_session (seat);
669- session_set_env (SESSION (greeter_session), "XDG_SEAT", "seat0");
670+ xdg_seat = "seat0";
671+ l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
672+ session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
673 if (!SEAT_UNITY (seat)->priv->use_vt_switching)
674 {
675 gchar *value = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->vt);
676+ l_debug (seat, "Setting XDG_VTNR=%s", value);
677 session_set_env (SESSION (greeter_session), "XDG_VTNR", value);
678 g_free (value);
679 }
680+ else
681+ l_debug (seat, "Not setting XDG_VTNR");
682
683 return greeter_session;
684 }
685@@ -525,15 +541,21 @@
686 seat_unity_create_session (Seat *seat)
687 {
688 Session *session;
689+ const gchar *xdg_seat;
690
691 session = SEAT_CLASS (seat_unity_parent_class)->create_session (seat);
692- session_set_env (session, "XDG_SEAT", "seat0");
693+ xdg_seat = "seat0";
694+ l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
695+ session_set_env (session, "XDG_SEAT", xdg_seat);
696 if (!SEAT_UNITY (seat)->priv->use_vt_switching)
697 {
698 gchar *value = g_strdup_printf ("%d", SEAT_UNITY (seat)->priv->vt);
699+ l_debug (seat, "Setting XDG_VTNR=%s", value);
700 session_set_env (SESSION (session), "XDG_VTNR", value);
701 g_free (value);
702 }
703+ else
704+ l_debug (seat, "Not setting XDG_VTNR");
705
706 return session;
707 }
708@@ -572,11 +594,11 @@
709
710 if (id)
711 {
712- g_debug ("Switching to Mir session %s", id);
713+ l_debug (seat, "Switching to Mir session %s", id);
714 write_message (SEAT_UNITY (seat), USC_MESSAGE_SET_ACTIVE_SESSION, (const guint8 *) id, strlen (id));
715 }
716 else
717- g_warning ("Failed to work out session ID");
718+ l_warning (seat, "Failed to work out session ID");
719 }
720
721 SEAT_CLASS (seat_unity_parent_class)->set_active_session (seat, session);
722
723=== modified file 'src/seat-xlocal.c'
724--- src/seat-xlocal.c 2013-07-26 04:52:07 +0000
725+++ src/seat-xlocal.c 2013-08-05 07:39:31 +0000
726@@ -69,9 +69,9 @@
727 gint vt = -1, port = 0;
728
729 if (vt > 0)
730- g_debug ("Starting local X display on VT %d", vt);
731+ l_debug (seat, "Starting local X display on VT %d", vt);
732 else
733- g_debug ("Starting local X display");
734+ l_debug (seat, "Starting local X display");
735
736 x_server = x_server_local_new ();
737
738@@ -95,7 +95,10 @@
739 plymouth_deactivate ();
740 }
741 else
742- g_debug ("Plymouth is running on VT %d, but this is less than the configured minimum of %d so not replacing it", active_vt, vt_get_min ());
743+ l_debug (seat,
744+ "Plymouth is running on VT %d,"
745+ " but this is less than the configured minimum of %d"
746+ " so not replacing it", active_vt, vt_get_min ());
747 }
748 if (plymouth_get_is_active ())
749 plymouth_quit (FALSE);
750@@ -138,7 +141,7 @@
751 keys = g_key_file_new ();
752 result = g_key_file_load_from_file (keys, path, G_KEY_FILE_NONE, &error);
753 if (error)
754- g_debug ("Error getting key %s", error->message);
755+ l_debug (seat, "Error getting key %s", error->message);
756 g_clear_error (&error);
757
758 if (result)
759@@ -148,7 +151,7 @@
760 if (g_key_file_has_key (keys, "keyring", key_name, NULL))
761 key = g_key_file_get_string (keys, "keyring", key_name, NULL);
762 else
763- g_debug ("Key %s not defined", key_name);
764+ l_debug (seat, "Key %s not defined", key_name);
765
766 if (key)
767 x_server_local_set_xdmcp_key (x_server, key);
768@@ -166,9 +169,12 @@
769 seat_xlocal_create_greeter_session (Seat *seat)
770 {
771 Greeter *greeter_session;
772+ const gchar *xdg_seat;
773
774 greeter_session = SEAT_CLASS (seat_xlocal_parent_class)->create_greeter_session (seat);
775- session_set_env (SESSION (greeter_session), "XDG_SEAT", "seat0");
776+ xdg_seat = "seat0";
777+ l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
778+ session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
779
780 return greeter_session;
781 }
782@@ -177,9 +183,12 @@
783 seat_xlocal_create_session (Seat *seat)
784 {
785 Session *session;
786+ const gchar *xdg_seat;
787
788 session = SEAT_CLASS (seat_xlocal_parent_class)->create_session (seat);
789- session_set_env (SESSION (session), "XDG_SEAT", "seat0");
790+ xdg_seat = "seat0";
791+ l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
792+ session_set_env (SESSION (session), "XDG_SEAT", xdg_seat);
793
794 return session;
795 }
796
797=== modified file 'src/seat-xremote.c'
798--- src/seat-xremote.c 2013-07-24 23:53:37 +0000
799+++ src/seat-xremote.c 2013-08-05 07:39:31 +0000
800@@ -33,7 +33,9 @@
801
802 if (strcmp (session_type, "x") != 0)
803 {
804- g_warning ("X remote seat only supports X display servers, not '%s'", session_type);
805+ l_warning (seat,
806+ "X remote seat only supports X display servers, not '%s'",
807+ session_type);
808 return NULL;
809 }
810
811@@ -42,7 +44,7 @@
812 hostname = "localhost";
813 number = seat_get_integer_property (seat, "xserver-display-number");
814
815- g_debug ("Starting remote X display %s:%d", hostname, number);
816+ l_debug (seat, "Starting remote X display %s:%d", hostname, number);
817
818 x_server = x_server_remote_new (hostname, number, NULL);
819
820@@ -53,9 +55,12 @@
821 seat_xremote_create_greeter_session (Seat *seat)
822 {
823 Greeter *greeter_session;
824+ const gchar *xdg_seat;
825
826 greeter_session = SEAT_CLASS (seat_xremote_parent_class)->create_greeter_session (seat);
827- session_set_env (SESSION (greeter_session), "XDG_SEAT", "seat0");
828+ xdg_seat = "seat0";
829+ l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
830+ session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
831
832 return greeter_session;
833 }
834@@ -64,9 +69,12 @@
835 seat_xremote_create_session (Seat *seat)
836 {
837 Session *session;
838+ const gchar *xdg_seat;
839
840 session = SEAT_CLASS (seat_xremote_parent_class)->create_session (seat);
841- session_set_env (SESSION (session), "XDG_SEAT", "seat0");
842+ xdg_seat = "seat0";
843+ l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
844+ session_set_env (SESSION (session), "XDG_SEAT", xdg_seat);
845
846 return session;
847 }
848
849=== modified file 'src/seat.c'
850--- src/seat.c 2013-07-30 14:04:44 +0000
851+++ src/seat.c 2013-08-05 07:39:31 +0000
852@@ -63,7 +63,11 @@
853 #define USER_SERVICE "lightdm"
854 #define AUTOLOGIN_SERVICE "lightdm-autologin"
855
856-G_DEFINE_TYPE (Seat, seat, G_TYPE_OBJECT);
857+static void seat_logger_iface_init (LoggerInterface *iface);
858+
859+G_DEFINE_TYPE_WITH_CODE (Seat, seat, G_TYPE_OBJECT,
860+ G_IMPLEMENT_INTERFACE (
861+ LOGGER_TYPE, seat_logger_iface_init));
862
863 typedef struct
864 {
865@@ -191,7 +195,7 @@
866
867 if (IS_GREETER (s))
868 {
869- g_debug ("Stopping greeter");
870+ l_debug (seat, "Stopping greeter");
871 session_stop (s);
872 }
873 }
874@@ -261,7 +265,9 @@
875 exit_status = process_get_exit_status (script);
876 if (WIFEXITED (exit_status))
877 {
878- g_debug ("Exit status of %s: %d", script_name, WEXITSTATUS (exit_status));
879+ l_debug (seat,
880+ "Exit status of %s: %d",
881+ script_name, WEXITSTATUS (exit_status));
882 result = WEXITSTATUS (exit_status) == EXIT_SUCCESS;
883 }
884 }
885@@ -299,7 +305,7 @@
886 g_list_length (seat->priv->sessions) == 0)
887 {
888 seat->priv->stopped = TRUE;
889- g_debug ("Seat stopped");
890+ l_debug (seat, "Seat stopped");
891 g_signal_emit (seat, signals[STOPPED], 0);
892 }
893 }
894@@ -316,7 +322,7 @@
895 GList *list, *link;
896 Session *active_session;
897
898- g_debug ("Display server stopped");
899+ l_debug (seat, "Display server stopped");
900
901 g_signal_handlers_disconnect_matched (display_server, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat);
902 seat->priv->display_servers = g_list_remove (seat->priv->display_servers, display_server);
903@@ -344,11 +350,12 @@
904 !session_get_is_started (session) &&
905 g_list_length (seat->priv->display_servers) == 0)
906 {
907- g_debug ("Stopping seat, greeter display server failed to start");
908+ l_debug (seat,
909+ "Stopping seat, greeter display server failed to start");
910 seat_stop (seat);
911 }
912
913- g_debug ("Stopping session");
914+ l_debug (seat, "Stopping session");
915 session_stop (session);
916 }
917 g_list_free_full (list, g_object_unref);
918@@ -359,7 +366,7 @@
919 active_session = seat_get_active_session (seat);
920 if (!active_session || session_get_display_server (active_session) == display_server)
921 {
922- g_debug ("Active display server stopped, starting greeter");
923+ l_debug (seat, "Active display server stopped, starting greeter");
924 seat_switch_to_greeter (seat);
925 }
926 }
927@@ -396,7 +403,7 @@
928 display_server = create_display_server (seat, session_get_session_type (session));
929 if (!display_server_start (display_server))
930 {
931- g_debug ("Failed to start display server for greeter");
932+ l_debug (seat, "Failed to start display server for greeter");
933 seat_stop (seat);
934 }
935
936@@ -431,12 +438,12 @@
937
938 if (IS_GREETER (session))
939 {
940- g_debug ("Failed to start greeter");
941+ l_debug (seat, "Failed to start greeter");
942 display_server_stop (session_get_display_server (session));
943 return;
944 }
945
946- g_debug ("Failed to start session, starting greeter");
947+ l_debug (seat, "Failed to start session, starting greeter");
948 switch_to_greeter_from_failed_session (seat, session);
949 }
950
951@@ -451,7 +458,7 @@
952 script = seat_get_string_property (seat, "session-setup-script");
953 if (script && !run_script (seat, session_get_display_server (session), script, NULL))
954 {
955- g_debug ("Switching to greeter due to failed setup script");
956+ l_debug (seat, "Switching to greeter due to failed setup script");
957 switch_to_greeter_from_failed_session (seat, session);
958 return;
959 }
960@@ -479,17 +486,17 @@
961 {
962 if (session_get_is_authenticated (session))
963 {
964- g_debug ("Session authenticated, running command");
965+ l_debug (seat, "Session authenticated, running command");
966 run_session (seat, session);
967 }
968 else if (!IS_GREETER (session))
969 {
970- g_debug ("Switching to greeter due to failed authentication");
971+ l_debug (seat, "Switching to greeter due to failed authentication");
972 switch_to_greeter_from_failed_session (seat, session);
973 }
974 else
975 {
976- g_debug ("Stopping session that failed authentication");
977+ l_debug (seat, "Stopping session that failed authentication");
978 session_stop (session);
979 }
980 }
981@@ -499,7 +506,7 @@
982 {
983 DisplayServer *display_server;
984
985- g_debug ("Session stopped");
986+ l_debug (seat, "Session stopped");
987
988 g_signal_handlers_disconnect_matched (session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat);
989 seat->priv->sessions = g_list_remove (seat->priv->sessions, session);
990@@ -552,12 +559,13 @@
991
992 if (session_get_is_authenticated (s))
993 {
994- g_debug ("Greeter stopped, running session");
995+ l_debug (seat, "Greeter stopped, running session");
996 run_session (seat, s);
997 }
998 else
999 {
1000- g_debug ("Greeter stopped, starting session authentication");
1001+ l_debug (seat,
1002+ "Greeter stopped, starting session authentication");
1003 start_session (seat, s);
1004 }
1005 break;
1006@@ -569,13 +577,13 @@
1007 g_list_length (seat->priv->display_servers) == 1 &&
1008 g_list_nth_data (seat->priv->display_servers, 0) == display_server)
1009 {
1010- g_debug ("Stopping seat, failed to start a greeter");
1011+ l_debug (seat, "Stopping seat, failed to start a greeter");
1012 seat_stop (seat);
1013 }
1014 /* If we were the active session, switch to a greeter */
1015 else if (!IS_GREETER (session) && session == seat_get_active_session (seat))
1016 {
1017- g_debug ("Active session stopped, starting greeter");
1018+ l_debug (seat, "Active session stopped, starting greeter");
1019 seat_switch_to_greeter (seat);
1020 }
1021
1022@@ -595,7 +603,7 @@
1023 }
1024 if (n_sessions == 0)
1025 {
1026- g_debug ("Stopping display server, no sessions require it");
1027+ l_debug (seat, "Stopping display server, no sessions require it");
1028 display_server_stop (display_server);
1029 }
1030 }
1031@@ -652,7 +660,8 @@
1032 }
1033
1034 static gchar **
1035-get_session_argv (SessionConfig *session_config, const gchar *session_wrapper)
1036+get_session_argv (Seat *seat, SessionConfig *session_config,
1037+ const gchar *session_wrapper)
1038 {
1039 gboolean result;
1040 int argc;
1041@@ -673,7 +682,8 @@
1042 /* Split command into an array listing and make command absolute */
1043 result = g_shell_parse_argv (session_config_get_command (session_config), &argc, &argv, &error);
1044 if (error)
1045- g_debug ("Invalid session command '%s': %s", session_config_get_command (session_config), error->message);
1046+ l_debug (seat, "Invalid session command '%s': %s",
1047+ session_config_get_command (session_config), error->message);
1048 g_clear_error (&error);
1049 if (!result)
1050 return NULL;
1051@@ -688,7 +698,8 @@
1052 }
1053
1054 static SessionConfig *
1055-find_session_config (const gchar *sessions_dir, const gchar *session_name)
1056+find_session_config (Seat *seat, const gchar *sessions_dir,
1057+ const gchar *session_name)
1058 {
1059 gchar **dirs;
1060 SessionConfig *session_config = NULL;
1061@@ -712,7 +723,8 @@
1062 break;
1063
1064 if (dirs[i+1] == NULL)
1065- g_debug ("Failed to find session configuration %s", session_name);
1066+ l_debug (seat, "Failed to find session configuration %s",
1067+ session_name);
1068 g_clear_error (&error);
1069 }
1070 g_strfreev (dirs);
1071@@ -729,13 +741,13 @@
1072 SessionConfig *session_config;
1073 Session *session = NULL;
1074
1075- g_debug ("Creating user session");
1076+ l_debug (seat, "Creating user session");
1077
1078 /* Load user preferences */
1079 user = accounts_get_user_by_name (username);
1080 if (!user)
1081 {
1082- g_debug ("Can't login unknown user '%s'", username);
1083+ l_debug (seat, "Can't login unknown user '%s'", username);
1084 return NULL;
1085 }
1086 session_name = user_get_xsession (user);
1087@@ -744,7 +756,7 @@
1088 if (!session_name)
1089 session_name = seat_get_string_property (seat, "user-session");
1090 sessions_dir = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
1091- session_config = find_session_config (sessions_dir, session_name);
1092+ session_config = find_session_config (seat, sessions_dir, session_name);
1093 g_free (sessions_dir);
1094 if (session_config)
1095 {
1096@@ -762,14 +774,18 @@
1097 session_set_pam_service (session, AUTOLOGIN_SERVICE);
1098 session_set_username (session, username);
1099 session_set_do_authenticate (session, TRUE);
1100- argv = get_session_argv (session_config, seat_get_string_property (seat, "session-wrapper"));
1101+ argv = get_session_argv (
1102+ seat, session_config,
1103+ seat_get_string_property (seat, "session-wrapper"));
1104 session_set_argv (session, argv);
1105 g_strfreev (argv);
1106
1107 g_object_unref (session_config);
1108 }
1109 else
1110- g_debug ("Can't find session '%s'", seat_get_string_property (seat, "user-session"));
1111+ l_debug (seat,
1112+ "Can't find session '%s'",
1113+ seat_get_string_property (seat, "user-session"));
1114
1115
1116 g_object_unref (user);
1117@@ -785,11 +801,14 @@
1118 Session *session;
1119
1120 sessions_dir = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
1121- session_config = find_session_config (sessions_dir, seat_get_string_property (seat, "user-session"));
1122+ session_config = find_session_config (
1123+ seat, sessions_dir, seat_get_string_property (seat, "user-session"));
1124 g_free (sessions_dir);
1125 if (!session_config)
1126 {
1127- g_debug ("Can't find session '%s'", seat_get_string_property (seat, "user-session"));
1128+ l_debug (seat,
1129+ "Can't find session '%s'",
1130+ seat_get_string_property (seat, "user-session"));
1131 return NULL;
1132 }
1133
1134@@ -797,7 +816,9 @@
1135 session_set_session_type (session, session_config_get_session_type (session_config));
1136 session_set_do_authenticate (session, TRUE);
1137 session_set_is_guest (session, TRUE);
1138- argv = get_session_argv (session_config, seat_get_string_property (seat, "session-wrapper"));
1139+ argv = get_session_argv (
1140+ seat, session_config,
1141+ seat_get_string_property (seat, "session-wrapper"));
1142 g_object_unref (session_config);
1143 session_set_argv (session, argv);
1144 g_strfreev (argv);
1145@@ -885,7 +906,7 @@
1146 existing_session = find_user_session (seat, username);
1147 if (existing_session && session != existing_session)
1148 {
1149- g_debug ("Returning to existing user session %s", username);
1150+ l_debug (seat, "Returning to existing user session %s", username);
1151 session_stop (session);
1152 seat_set_active_session (seat, existing_session);
1153 return TRUE;
1154@@ -916,16 +937,20 @@
1155 if (user)
1156 user_set_xsession (session_get_user (session), session_name);
1157
1158- session_config = find_session_config (sessions_dir, session_name);
1159+ session_config = find_session_config (seat, sessions_dir, session_name);
1160 g_free (sessions_dir);
1161 if (!session_config)
1162 {
1163- g_debug ("Can't find session '%s'", seat_get_string_property (seat, "user-session"));
1164+ l_debug (seat,
1165+ "Can't find session '%s'",
1166+ seat_get_string_property (seat, "user-session"));
1167 return FALSE;
1168 }
1169
1170 session_set_session_type (session, session_config_get_session_type (session_config));
1171- argv = get_session_argv (session_config, seat_get_string_property (seat, "session-wrapper"));
1172+ argv = get_session_argv (
1173+ seat, session_config,
1174+ seat_get_string_property (seat, "session-wrapper"));
1175 session_set_argv (session, argv);
1176 g_strfreev (argv);
1177 session_set_env (session, "DESKTOP_SESSION", session_name);
1178@@ -943,7 +968,9 @@
1179 if (can_share_display_server (seat, display_server) &&
1180 strcmp (display_server_get_session_type (display_server), session_get_session_type (session)) == 0)
1181 {
1182- g_debug ("Stopping greeter; display server will be re-used for user session");
1183+ l_debug (seat,
1184+ "Stopping greeter; display server will be re-used"
1185+ " for user session");
1186
1187 /* Run on the same display server after the greeter has stopped */
1188 session_set_display_server (session, display_server);
1189@@ -960,7 +987,7 @@
1190 session_set_display_server (session, display_server);
1191 if (!display_server_start (display_server))
1192 {
1193- g_debug ("Failed to start display server for new session");
1194+ l_debug (seat, "Failed to start display server for new session");
1195 return FALSE;
1196 }
1197
1198@@ -977,15 +1004,16 @@
1199 gchar *greeter_user;
1200 const gchar *greeter_wrapper;
1201
1202- g_debug ("Creating greeter session");
1203+ l_debug (seat, "Creating greeter session");
1204
1205 sessions_dir = config_get_string (config_get_instance (), "LightDM", "greeters-directory");
1206- session_config = find_session_config (sessions_dir, seat_get_string_property (seat, "greeter-session"));
1207+ session_config = find_session_config (
1208+ seat, sessions_dir, seat_get_string_property (seat, "greeter-session"));
1209 g_free (sessions_dir);
1210 if (!session_config)
1211 return NULL;
1212
1213- argv = get_session_argv (session_config, NULL);
1214+ argv = get_session_argv (seat, session_config, NULL);
1215 greeter_wrapper = seat_get_string_property (seat, "greeter-wrapper");
1216 if (greeter_wrapper)
1217 {
1218@@ -1052,7 +1080,7 @@
1219 script = seat_get_string_property (seat, "display-setup-script");
1220 if (script && !run_script (seat, display_server, script, NULL))
1221 {
1222- g_debug ("Stopping display server due to failed setup script");
1223+ l_debug (seat, "Stopping display server due to failed setup script");
1224 display_server_stop (display_server);
1225 return;
1226 }
1227@@ -1069,18 +1097,19 @@
1228 {
1229 if (session_get_is_authenticated (session))
1230 {
1231- g_debug ("Display server ready, running session");
1232+ l_debug (seat, "Display server ready, running session");
1233 run_session (seat, session);
1234 }
1235 else
1236 {
1237- g_debug ("Display server ready, starting session authentication");
1238+ l_debug (seat,
1239+ "Display server ready, starting session authentication");
1240 start_session (seat, session);
1241 }
1242 }
1243 else
1244 {
1245- g_debug ("Stopping not required display server");
1246+ l_debug (seat, "Stopping not required display server");
1247 display_server_stop (display_server);
1248 }
1249 }
1250@@ -1090,7 +1119,7 @@
1251 {
1252 DisplayServer *display_server;
1253
1254- g_debug ("Creating display server of type %s", session_type);
1255+ l_debug (seat, "Creating display server of type %s", session_type);
1256
1257 display_server = SEAT_GET_CLASS (seat)->create_display_server (seat, session_type);
1258 if (!display_server)
1259@@ -1133,7 +1162,7 @@
1260 greeter_session = find_greeter_session (seat);
1261 if (greeter_session)
1262 {
1263- g_debug ("Switching to existing greeter");
1264+ l_debug (seat, "Switching to existing greeter");
1265 seat_set_active_session (seat, SESSION (greeter_session));
1266 return TRUE;
1267 }
1268@@ -1163,12 +1192,12 @@
1269 if (!seat->priv->can_switch)
1270 return FALSE;
1271
1272- g_debug ("Switching to user %s", username);
1273+ l_debug (seat, "Switching to user %s", username);
1274
1275 session = find_user_session (seat, username);
1276 if (session)
1277 {
1278- g_debug ("Switching to existing user session %s", username);
1279+ l_debug (seat, "Switching to existing user session %s", username);
1280 seat_set_active_session (seat, session);
1281 return TRUE;
1282 }
1283@@ -1219,7 +1248,9 @@
1284 session = find_guest_session (seat);
1285 if (session)
1286 {
1287- g_debug ("Switching to existing guest account %s", session_get_username (session));
1288+ l_debug (seat,
1289+ "Switching to existing guest account %s",
1290+ session_get_username (session));
1291 seat_set_active_session (seat, session);
1292 return TRUE;
1293 }
1294@@ -1252,13 +1283,13 @@
1295 if (!seat->priv->can_switch)
1296 return FALSE;
1297
1298- g_debug ("Locking seat");
1299+ l_debug (seat, "Locking seat");
1300
1301 /* Switch to greeter if one open (shouldn't be though) */
1302 greeter_session = find_greeter_session (seat);
1303 if (greeter_session)
1304 {
1305- g_debug ("Switching to existing greeter");
1306+ l_debug (seat, "Switching to existing greeter");
1307 seat_set_active_session (seat, SESSION (greeter_session));
1308 return TRUE;
1309 }
1310@@ -1290,7 +1321,7 @@
1311 if (seat->priv->stopping)
1312 return;
1313
1314- g_debug ("Stopping seat");
1315+ l_debug (seat, "Stopping seat");
1316 seat->priv->stopping = TRUE;
1317 SEAT_GET_CLASS (seat)->stop (seat);
1318 }
1319@@ -1322,7 +1353,7 @@
1320 gboolean autologin_in_background;
1321 Session *session = NULL, *background_session = NULL;
1322
1323- g_debug ("Starting seat");
1324+ l_debug (seat, "Starting seat");
1325
1326 /* If this display server doesn't have a session running on it, just start it */
1327 if (!get_start_local_sessions (seat))
1328@@ -1370,7 +1401,8 @@
1329 session_set_display_server (session, display_server);
1330 if (!display_server || !display_server_start (display_server))
1331 {
1332- g_debug ("Can't create display server for automatic login");
1333+ l_debug (seat,
1334+ "Can't create display server for automatic login");
1335 session_stop (session);
1336 if (display_server)
1337 display_server_stop (display_server);
1338@@ -1388,7 +1420,7 @@
1339 greeter_session = create_greeter_session (seat);
1340 if (!greeter_session)
1341 {
1342- g_debug ("Failed to create greeter session");
1343+ l_debug (seat, "Failed to create greeter session");
1344 return FALSE;
1345 }
1346
1347@@ -1414,7 +1446,7 @@
1348 session_set_display_server (session, display_server);
1349 if (!display_server || !display_server_start (display_server))
1350 {
1351- g_debug ("Can't create display server for greeter");
1352+ l_debug (seat, "Can't create display server for greeter");
1353 session_stop (session);
1354 if (display_server)
1355 display_server_stop (display_server);
1356@@ -1437,7 +1469,8 @@
1357 background_display_server = create_display_server (seat, session_get_session_type (background_session));
1358 session_set_display_server (background_session, background_display_server);
1359 if (!display_server_start (background_display_server))
1360- g_warning ("Failed to start display server for background session");
1361+ l_warning (seat,
1362+ "Failed to start display server for background session");
1363 }
1364
1365 seat->priv->started = TRUE;
1366@@ -1486,7 +1519,7 @@
1367 DisplayServer *display_server = link->data;
1368 if (!display_server_get_is_stopping (display_server))
1369 {
1370- g_debug ("Stopping display server");
1371+ l_debug (seat, "Stopping display server");
1372 display_server_stop (display_server);
1373 }
1374 }
1375@@ -1499,7 +1532,7 @@
1376 Session *session = link->data;
1377 if (!session_get_is_stopping (session))
1378 {
1379- g_debug ("Stopping session");
1380+ l_debug (seat, "Stopping session");
1381 session_stop (session);
1382 }
1383 }
1384@@ -1593,3 +1626,17 @@
1385 NULL,
1386 G_TYPE_NONE, 0);
1387 }
1388+
1389+static gint
1390+seat_real_logprefix (Logger *self, gchar *buf, gulong buflen)
1391+{
1392+ Seat *seat = SEAT (self);
1393+ return g_snprintf (buf, buflen, "Seat %s: ",
1394+ seat_get_string_property (seat, "seat-name"));
1395+}
1396+
1397+static void
1398+seat_logger_iface_init (LoggerInterface *iface)
1399+{
1400+ iface->logprefix = &seat_real_logprefix;
1401+}
1402
1403=== modified file 'src/seat.h'
1404--- src/seat.h 2013-07-25 23:40:02 +0000
1405+++ src/seat.h 2013-08-05 07:39:31 +0000
1406@@ -17,6 +17,7 @@
1407 #include "greeter.h"
1408 #include "session.h"
1409 #include "process.h"
1410+#include "logger.h"
1411
1412 G_BEGIN_DECLS
1413
1414
1415=== modified file 'src/session.c'
1416--- src/session.c 2013-07-26 02:27:41 +0000
1417+++ src/session.c 2013-08-05 07:39:31 +0000
1418@@ -120,7 +120,11 @@
1419 /* Maximum length of a string to pass between daemon and session */
1420 #define MAX_STRING_LENGTH 65535
1421
1422-G_DEFINE_TYPE (Session, session, G_TYPE_OBJECT);
1423+static void session_logger_iface_init (LoggerInterface *iface);
1424+
1425+G_DEFINE_TYPE_WITH_CODE (Session, session, G_TYPE_OBJECT,
1426+ G_IMPLEMENT_INTERFACE (
1427+ LOGGER_TYPE, session_logger_iface_init));
1428
1429 Session *
1430 session_new (void)
1431@@ -338,7 +342,7 @@
1432 write_data (Session *session, const void *buf, size_t count)
1433 {
1434 if (write (session->priv->to_child_input, buf, count) != count)
1435- g_warning ("Error writing to session: %s", strerror (errno));
1436+ l_warning (session, "Error writing to session: %s", strerror (errno));
1437 }
1438
1439 static void
1440@@ -382,7 +386,7 @@
1441 ssize_t n_read;
1442 n_read = read (session->priv->from_child_output, buf, count);
1443 if (n_read < 0)
1444- g_warning ("Error reading from session: %s", strerror (errno));
1445+ l_warning (session, "Error reading from session: %s", strerror (errno));
1446 return n_read;
1447 }
1448
1449@@ -398,7 +402,7 @@
1450 return NULL;
1451 if (length > MAX_STRING_LENGTH)
1452 {
1453- g_warning ("Invalid string length %d from child", length);
1454+ l_warning (session, "Invalid string length %d from child", length);
1455 return NULL;
1456 }
1457
1458@@ -414,17 +418,18 @@
1459 {
1460 Session *session = data;
1461
1462- session->priv->pid = 0;
1463-
1464 if (WIFEXITED (status))
1465- g_debug ("Session %d exited with return value %d", pid, WEXITSTATUS (status));
1466+ l_debug (session, "exited with return value %d", WEXITSTATUS (status));
1467 else if (WIFSIGNALED (status))
1468- g_debug ("Session %d terminated with signal %d", pid, WTERMSIG (status));
1469+ l_debug (session, "terminated with signal %d", WTERMSIG (status));
1470+
1471+ /* do this as late as possible for log messages prefix */
1472+ session->priv->pid = 0;
1473
1474 /* If failed during authentication then report this as an authentication failure */
1475 if (session->priv->authentication_started && !session->priv->authentication_complete)
1476 {
1477- g_debug ("Session %d failed during authentication", pid);
1478+ l_debug (session, "failed during authentication");
1479 session->priv->authentication_complete = TRUE;
1480 session->priv->authentication_result = PAM_CONV_ERR;
1481 g_free (session->priv->authentication_result_string);
1482@@ -473,7 +478,7 @@
1483 /* Check if authentication completed */
1484 n_read = read_from_child (session, &auth_complete, sizeof (auth_complete));
1485 if (n_read < 0)
1486- g_debug ("Error reading from child: %s", strerror (errno));
1487+ l_debug (session, "Error reading from child: %s", strerror (errno));
1488 if (n_read <= 0)
1489 {
1490 session->priv->from_child_watch = 0;
1491@@ -487,7 +492,10 @@
1492 g_free (session->priv->authentication_result_string);
1493 session->priv->authentication_result_string = read_string_from_child (session);
1494
1495- g_debug ("Session %d authentication complete with return value %d: %s", session->priv->pid, session->priv->authentication_result, session->priv->authentication_result_string);
1496+ l_debug (session,
1497+ "authentication complete with return value %d: %s",
1498+ session->priv->authentication_result,
1499+ session->priv->authentication_result_string);
1500
1501 /* No longer expect any more messages */
1502 session->priv->from_child_watch = 0;
1503@@ -510,7 +518,8 @@
1504 m->msg = read_string_from_child (session);
1505 }
1506
1507- g_debug ("Session %d got %d message(s) from PAM", session->priv->pid, session->priv->messages_length);
1508+ l_debug (session,
1509+ "got %d message(s) from PAM", session->priv->messages_length);
1510
1511 g_signal_emit (G_OBJECT (session), signals[GOT_MESSAGES], 0);
1512 }
1513@@ -616,7 +625,9 @@
1514 write_string (session, session->priv->xdisplay);
1515 write_xauth (session, session->priv->x_authority);
1516
1517- g_debug ("Started session %d with service '%s', username '%s'", session->priv->pid, session->priv->pam_service, session->priv->username);
1518+ l_debug (session,
1519+ "Started with service '%s', username '%s'",
1520+ session->priv->pam_service, session->priv->username);
1521
1522 return TRUE;
1523 }
1524@@ -727,7 +738,7 @@
1525 session->priv->command_run = TRUE;
1526
1527 command = g_strjoinv (" ", session->priv->argv);
1528- g_debug ("Session %d running command %s", session->priv->pid, command);
1529+ l_debug (session, "running command %s", command);
1530 g_free (command);
1531
1532 /* Create authority location */
1533@@ -740,11 +751,15 @@
1534 g_free (run_dir);
1535
1536 if (g_mkdir_with_parents (dir, S_IRWXU) < 0)
1537- g_warning ("Failed to set create system authority dir %s: %s", dir, strerror (errno));
1538+ l_warning (session,
1539+ "Failed to set create system authority dir %s: %s",
1540+ dir, strerror (errno));
1541 if (getuid () == 0)
1542 {
1543 if (chown (dir, user_get_uid (session_get_user (session)), user_get_gid (session_get_user (session))) < 0)
1544- g_warning ("Failed to set ownership of user authority dir: %s", strerror (errno));
1545+ l_warning (session,
1546+ "Failed to set ownership of user authority dir: %s",
1547+ strerror (errno));
1548 }
1549
1550 x_authority_filename = g_build_filename (dir, "xauthority", NULL);
1551@@ -819,7 +834,7 @@
1552
1553 if (session->priv->pid > 0)
1554 {
1555- g_debug ("Session %d: Sending SIGTERM", session->priv->pid);
1556+ l_debug (session, "Sending SIGTERM");
1557 kill (session->priv->pid, SIGTERM);
1558 // FIXME: Handle timeout
1559 }
1560@@ -920,3 +935,19 @@
1561 NULL,
1562 G_TYPE_NONE, 0);
1563 }
1564+
1565+static gint
1566+session_real_logprefix (Logger *self, gchar *buf, gulong buflen)
1567+{
1568+ Session *session = SESSION (self);
1569+ if (session->priv->pid != 0)
1570+ return g_snprintf (buf, buflen, "Session pid=%d: ", session->priv->pid);
1571+ else
1572+ return g_snprintf (buf, buflen, "Session (not running): ");
1573+}
1574+
1575+static void
1576+session_logger_iface_init (LoggerInterface *iface)
1577+{
1578+ iface->logprefix = &session_real_logprefix;
1579+}
1580
1581=== modified file 'src/session.h'
1582--- src/session.h 2013-07-26 02:27:41 +0000
1583+++ src/session.h 2013-08-05 07:39:31 +0000
1584@@ -21,6 +21,7 @@
1585 #include "display-server.h"
1586 #include "accounts.h"
1587 #include "x-authority.h"
1588+#include "logger.h"
1589
1590 G_BEGIN_DECLS
1591
1592
1593=== modified file 'src/x-server-local.c'
1594--- src/x-server-local.c 2013-07-26 01:23:05 +0000
1595+++ src/x-server-local.c 2013-08-05 07:39:31 +0000
1596@@ -333,7 +333,9 @@
1597
1598 fd = g_open (server->priv->log_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
1599 if (fd < 0)
1600- g_warning ("Failed to open log file %s: %s", server->priv->log_file, g_strerror (errno));
1601+ l_warning (server,
1602+ "Failed to open log file %s: %s",
1603+ server->priv->log_file, g_strerror (errno));
1604 else
1605 {
1606 dup2 (fd, STDOUT_FILENO);
1607@@ -352,7 +354,9 @@
1608 if (signum == SIGUSR1 && !server->priv->got_signal)
1609 {
1610 server->priv->got_signal = TRUE;
1611- g_debug ("Got signal from X server :%d", x_server_get_display_number (X_SERVER (server)));
1612+ l_debug (server,
1613+ "Got signal from X server :%d",
1614+ x_server_get_display_number (X_SERVER (server)));
1615
1616 // FIXME: Check return value
1617 DISPLAY_SERVER_CLASS (x_server_local_parent_class)->start (DISPLAY_SERVER (server));
1618@@ -362,7 +366,7 @@
1619 static void
1620 stopped_cb (Process *process, XServerLocal *server)
1621 {
1622- g_debug ("X server stopped");
1623+ l_debug (server, "X server stopped");
1624
1625 /* Release VT and display number for re-use */
1626 if (server->priv->have_vt_ref)
1627@@ -374,7 +378,8 @@
1628
1629 if (x_server_get_authority (X_SERVER (server)) && server->priv->authority_file)
1630 {
1631- g_debug ("Removing X server authority %s", server->priv->authority_file);
1632+ l_debug (server,
1633+ "Removing X server authority %s", server->priv->authority_file);
1634
1635 g_unlink (server->priv->authority_file);
1636
1637@@ -404,17 +409,20 @@
1638 dir = g_build_filename (run_dir, "root", NULL);
1639 g_free (run_dir);
1640 if (g_mkdir_with_parents (dir, S_IRWXU) < 0)
1641- g_warning ("Failed to make authority directory %s: %s", dir, strerror (errno));
1642+ l_warning (server,
1643+ "Failed to make authority directory %s: %s",
1644+ dir, strerror (errno));
1645
1646 server->priv->authority_file = g_build_filename (dir, x_server_get_address (X_SERVER (server)), NULL);
1647 g_free (dir);
1648 }
1649
1650- g_debug ("Writing X server authority to %s", server->priv->authority_file);
1651+ l_debug (server,
1652+ "Writing X server authority to %s", server->priv->authority_file);
1653
1654 x_authority_write (authority, XAUTH_WRITE_MODE_REPLACE, server->priv->authority_file, &error);
1655 if (error)
1656- g_warning ("Failed to write authority: %s", error->message);
1657+ l_warning (server, "Failed to write authority: %s", error->message);
1658 g_clear_error (&error);
1659 }
1660
1661@@ -442,14 +450,16 @@
1662 filename = g_strdup_printf ("%s.log", display_server_get_name (display_server));
1663 dir = config_get_string (config_get_instance (), "LightDM", "log-directory");
1664 server->priv->log_file = g_build_filename (dir, filename, NULL);
1665- g_debug ("Logging to %s", server->priv->log_file);
1666+ l_debug (display_server, "Logging to %s", server->priv->log_file);
1667 g_free (filename);
1668 g_free (dir);
1669
1670 absolute_command = get_absolute_command (server->priv->command);
1671 if (!absolute_command)
1672 {
1673- g_debug ("Can't launch X server %s, not found in path", server->priv->command);
1674+ l_debug (display_server,
1675+ "Can't launch X server %s, not found in path",
1676+ server->priv->command);
1677 stopped_cb (server->priv->x_server_process, X_SERVER_LOCAL (server));
1678 return FALSE;
1679 }
1680@@ -496,7 +506,7 @@
1681 process_set_command (server->priv->x_server_process, command->str);
1682 g_string_free (command, TRUE);
1683
1684- g_debug ("Launching X Server");
1685+ l_debug (display_server, "Launching X Server");
1686
1687 /* If running inside another display then pass through those variables */
1688 if (g_getenv ("DISPLAY"))
1689@@ -524,7 +534,9 @@
1690 result = process_start (server->priv->x_server_process, FALSE);
1691
1692 if (result)
1693- g_debug ("Waiting for ready signal from X server :%d", x_server_get_display_number (X_SERVER (server)));
1694+ l_debug (display_server,
1695+ "Waiting for ready signal from X server :%d",
1696+ x_server_get_display_number (X_SERVER (server)));
1697
1698 if (!result)
1699 stopped_cb (server->priv->x_server_process, X_SERVER_LOCAL (server));
1700
1701=== modified file 'src/x-server-xvnc.c'
1702--- src/x-server-xvnc.c 2013-07-26 02:27:41 +0000
1703+++ src/x-server-xvnc.c 2013-08-05 07:39:31 +0000
1704@@ -144,7 +144,9 @@
1705
1706 fd = g_open (server->priv->log_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
1707 if (fd < 0)
1708- g_warning ("Failed to open log file %s: %s", server->priv->log_file, g_strerror (errno));
1709+ l_warning (server,
1710+ "Failed to open log file %s: %s",
1711+ server->priv->log_file, g_strerror (errno));
1712 else
1713 {
1714 dup2 (fd, STDERR_FILENO);
1715@@ -162,7 +164,9 @@
1716 if (signum == SIGUSR1 && !server->priv->got_signal)
1717 {
1718 server->priv->got_signal = TRUE;
1719- g_debug ("Got signal from Xvnc server :%d", x_server_get_display_number (X_SERVER (server)));
1720+ l_debug (server,
1721+ "Got signal from Xvnc server :%d",
1722+ x_server_get_display_number (X_SERVER (server)));
1723
1724 // FIXME: Check return value
1725 DISPLAY_SERVER_CLASS (x_server_xvnc_parent_class)->start (DISPLAY_SERVER (server));
1726@@ -172,14 +176,15 @@
1727 static void
1728 stopped_cb (Process *process, XServerXVNC *server)
1729 {
1730- g_debug ("Xvnc server stopped");
1731+ l_debug (server, "Xvnc server stopped");
1732
1733 g_object_unref (server->priv->x_server_process);
1734 server->priv->x_server_process = NULL;
1735
1736 x_server_local_release_display_number (x_server_get_display_number (X_SERVER (server)));
1737
1738- g_debug ("Removing X server authority %s", server->priv->authority_file);
1739+ l_debug (server,
1740+ "Removing X server authority %s", server->priv->authority_file);
1741
1742 g_unlink (server->priv->authority_file);
1743 g_free (server->priv->authority_file);
1744@@ -219,14 +224,16 @@
1745 filename = g_strdup_printf ("%s.log", display_server_get_name (display_server));
1746 dir = config_get_string (config_get_instance (), "LightDM", "log-directory");
1747 server->priv->log_file = g_build_filename (dir, filename, NULL);
1748- g_debug ("Logging to %s", server->priv->log_file);
1749+ l_debug (display_server, "Logging to %s", server->priv->log_file);
1750 g_free (filename);
1751 g_free (dir);
1752
1753 absolute_command = get_absolute_command (server->priv->command);
1754 if (!absolute_command)
1755 {
1756- g_debug ("Can't launch X server %s, not found in path", server->priv->command);
1757+ l_debug (display_server,
1758+ "Can't launch X server %s, not found in path",
1759+ server->priv->command);
1760 stopped_cb (server->priv->x_server_process, X_SERVER_XVNC (server));
1761 return FALSE;
1762 }
1763@@ -241,16 +248,20 @@
1764 dir = g_build_filename (run_dir, "root", NULL);
1765 g_free (run_dir);
1766 if (g_mkdir_with_parents (dir, S_IRWXU) < 0)
1767- g_warning ("Failed to make authority directory %s: %s", dir, strerror (errno));
1768+ l_warning (display_server,
1769+ "Failed to make authority directory %s: %s",
1770+ dir, strerror (errno));
1771
1772 server->priv->authority_file = g_build_filename (dir, x_server_get_address (X_SERVER (server)), NULL);
1773 g_free (dir);
1774
1775- g_debug ("Writing X server authority to %s", server->priv->authority_file);
1776+ l_debug (display_server,
1777+ "Writing X server authority to %s", server->priv->authority_file);
1778
1779 x_authority_write (authority, XAUTH_WRITE_MODE_REPLACE, server->priv->authority_file, &error);
1780 if (error)
1781- g_warning ("Failed to write authority: %s", error->message);
1782+ l_warning (display_server,
1783+ "Failed to write authority: %s", error->message);
1784 g_clear_error (&error);
1785
1786 command = g_string_new (absolute_command);
1787@@ -267,7 +278,7 @@
1788 process_set_command (server->priv->x_server_process, command->str);
1789 g_string_free (command, TRUE);
1790
1791- g_debug ("Launching Xvnc server");
1792+ l_debug (display_server, "Launching Xvnc server");
1793
1794 /* Variable required for regression tests */
1795 if (g_getenv ("LIGHTDM_TEST_ROOT"))
1796@@ -279,7 +290,9 @@
1797 result = process_start (server->priv->x_server_process, FALSE);
1798
1799 if (result)
1800- g_debug ("Waiting for ready signal from Xvnc server :%d", x_server_get_display_number (X_SERVER (server)));
1801+ l_debug (display_server,
1802+ "Waiting for ready signal from Xvnc server :%d",
1803+ x_server_get_display_number (X_SERVER (server)));
1804
1805 if (!result)
1806 stopped_cb (server->priv->x_server_process, X_SERVER_XVNC (server));
1807
1808=== modified file 'src/x-server.c'
1809--- src/x-server.c 2013-07-30 15:56:44 +0000
1810+++ src/x-server.c 2013-08-05 07:39:31 +0000
1811@@ -133,11 +133,12 @@
1812 }
1813
1814 /* Open connection */
1815- g_debug ("Connecting to XServer %s", x_server_get_address (server));
1816+ l_debug (server, "Connecting to XServer %s", x_server_get_address (server));
1817 server->priv->connection = xcb_connect_to_display_with_auth_info (x_server_get_address (server), auth, NULL);
1818 if (xcb_connection_has_error (server->priv->connection))
1819 {
1820- g_debug ("Error connecting to XServer %s", x_server_get_address (server));
1821+ l_debug (server,
1822+ "Error connecting to XServer %s", x_server_get_address (server));
1823 return FALSE;
1824 }
1825
1826@@ -161,9 +162,12 @@
1827 g_free (t);
1828
1829 t = g_strdup_printf ("%d", vt);
1830+ l_debug (session, "Setting XDG_VTNR=%s", t);
1831 session_set_env (session, "XDG_VTNR", t);
1832 g_free (t);
1833 }
1834+ else
1835+ l_debug (session, "Not setting XDG_VTNR");
1836
1837 session_set_env (session, "DISPLAY", x_server_get_address (X_SERVER (display_server)));
1838 session_set_tty (session, x_server_get_address (X_SERVER (display_server)));

Subscribers

People subscribed via source and target branches