After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 728449 - Add a journald entry with MESSAGE_ID when Gnome Shell is started/loaded
Add a journald entry with MESSAGE_ID when Gnome Shell is started/loaded
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2014-04-17 17:18 UTC by Vadim Rutkovsky
Modified: 2014-05-03 21:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a journald log entry with MESSAGE_ID if systemd is enabled (2.05 KB, patch)
2014-04-18 20:57 UTC, Vadim Rutkovsky
reviewed Details | Review
Make sure we send the message only when we're in user mode (2.10 KB, patch)
2014-04-23 13:33 UTC, Vadim Rutkovsky
none Details | Review
Make sure we send the message only when we're in user mode (2.10 KB, patch)
2014-04-23 13:36 UTC, Vadim Rutkovsky
none Details | Review
Send a message after startup-complete signal (2.10 KB, patch)
2014-04-23 13:39 UTC, Vadim Rutkovsky
needs-work Details | Review
Add a journald log entry with MESSAGE_ID if systemd is enabled (2.21 KB, patch)
2014-04-25 13:55 UTC, Vadim Rutkovsky
none Details | Review
Add a journald log entry with MESSAGE_ID if systemd is enabled (2.21 KB, patch)
2014-04-25 17:19 UTC, Vadim Rutkovsky
reviewed Details | Review
Add a journald log entry with MESSAGE_ID if systemd is enabled (2.24 KB, patch)
2014-04-25 19:28 UTC, Vadim Rutkovsky
reviewed Details | Review
Add a journald log entry with MESSAGE_ID if systemd is enabled (2.05 KB, patch)
2014-04-28 16:44 UTC, Vadim Rutkovsky
committed Details | Review
main: Don't depend on GSystem unconditionally (1.64 KB, patch)
2014-05-03 19:12 UTC, Florian Müllner
committed Details | Review

Description Vadim Rutkovsky 2014-04-17 17:18:39 UTC
Smoketest on gnome-continuous now waits for gnome-session's message 'Entering running state' with specific MESSAGE_ID, but GNOME Shell doesn't write any log entry after it has loaded. This would solve 'black/garbled final screenshot on gnome-continuous' issue.
Comment 1 Vadim Rutkovsky 2014-04-18 20:57:36 UTC
Created attachment 274715 [details] [review]
Add a journald log entry with MESSAGE_ID if systemd is enabled
Comment 2 Ray Strode [halfline] 2014-04-23 13:29:02 UTC
Review of attachment 274715 [details] [review]:

::: js/ui/main.js
@@ +77,3 @@
 let dynamicWorkspacesSchema = null;
 
+let gnomeShellStartedMessageID = 'f3ea493c22934e26811cd62abe8e203a';

should be 

const STARTED_MESSAGE_ID = '...';

@@ +194,3 @@
+    if (LoginManager.haveSystemd()) {
+        GSystem.log_structured_print('GNOME Shell started at ' + _startDate,
+            ["MESSAGE_ID=" + gnomeShellStartedMessageID]);

i think there needs to be two different message ids, one for greeter and one for user session otherwise you'll pick up the message id from the login screen and take your screenshot too early.
Comment 3 Vadim Rutkovsky 2014-04-23 13:33:37 UTC
Created attachment 274947 [details] [review]
Make sure we send the message only when we're in user mode
Comment 4 Vadim Rutkovsky 2014-04-23 13:36:46 UTC
Created attachment 274949 [details] [review]
Make sure we send the message only when we're in user mode

Right, using 'const' now
Comment 5 Vadim Rutkovsky 2014-04-23 13:39:53 UTC
Created attachment 274954 [details] [review]
Send a message after startup-complete signal

As Rui has suggested, we should call it after startup-complete signal. We're waiting for 10 seconds after the message is found, so race condition will not hurt the screenshot
Comment 6 Ray Strode [halfline] 2014-04-24 11:49:10 UTC
Review of attachment 274954 [details] [review]:

wrong patch?  It doesn't seem to log after startup-complete like you said it would
Comment 7 Vadim Rutkovsky 2014-04-25 13:55:13 UTC
Created attachment 275128 [details] [review]
Add a journald log entry with MESSAGE_ID if systemd is enabled

(In reply to comment #6)
> Review of attachment 274954 [details] [review]:
> 
> wrong patch?  It doesn't seem to log after startup-complete like you said it
> would

Oops, my fault, this one should work now
Comment 8 Vadim Rutkovsky 2014-04-25 17:19:54 UTC
Created attachment 275151 [details] [review]
Add a journald log entry with MESSAGE_ID if systemd is enabled

Fixed a nasty typo
Comment 9 Ray Strode [halfline] 2014-04-25 19:15:28 UTC
Review of attachment 275151 [details] [review]:

::: js/ui/main.js
@@ +45,3 @@
 const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
 const STICKY_KEYS_ENABLE = 'stickykeys-enable';
+const gnomeShellStartedMessageID = 'f3ea493c22934e26811cd62abe8e203a';

should be all caps and separated by underscores

@@ +219,3 @@
+                                  GSystem.log_structured_print('GNOME Shell started at ' + _startDate,
+                                     ["MESSAGE_ID=" + gnomeShellStartedMessageID]);
+                                }

spacing is wrong on this brace, shouldn't use double quotes
Comment 10 Vadim Rutkovsky 2014-04-25 19:28:57 UTC
Created attachment 275162 [details] [review]
Add a journald log entry with MESSAGE_ID if systemd is enabled
Comment 11 Florian Müllner 2014-04-28 16:35:19 UTC
Review of attachment 275162 [details] [review]:

::: configure.ac
@@ +107,3 @@
             polkit-agent-1 >= $POLKIT_MIN_VERSION
+            gcr-base-3 >= $GCR_MIN_VERSION
+            libgsystem"

libgsystem is not a compile time dependency; we don't link to runtime deps

::: js/ui/main.js
@@ +218,3 @@
+                              if (LoginManager.haveSystemd() && sessionMode.currentMode === 'user') {
+                                  GSystem.log_structured_print('GNOME Shell started at ' + _startDate,
+                                                               ['MESSAGE_ID=' + GNOMESHELL_STARTED_MESSAGEID]);

Nitpick: MESSAGE_ID vs. MESSAGEID - consistency would be nice

Also: we log() the same message in _initializeUI() (which should end up in the journal as well), so probably a good idea to move that into an else block here.
Comment 12 Vadim Rutkovsky 2014-04-28 16:44:27 UTC
Created attachment 275364 [details] [review]
Add a journald log entry with MESSAGE_ID if systemd is enabled

(In reply to comment #11)
> libgsystem is not a compile time dependency; we don't link to runtime deps
Okay, removed it in next patch (or should I put it somewhere else? Please advice)

> Nitpick: MESSAGE_ID vs. MESSAGEID - consistency would be nice
Fixed

> Also: we log() the same message in _initializeUI() (which should end up in the
> journal as well), so probably a good idea to move that into an else block here.
Done, though GNOME Shell used to log two messages - one for gdm mode and one for user mode. Now nothing will be logged for gdm mode - I hope it will not break anybody's code
Comment 13 drago01 2014-04-28 16:47:07 UTC
(In reply to comment #12)
> Created an attachment (id=275364) [details] [review]
> Add a journald log entry with MESSAGE_ID if systemd is enabled
> 
> (In reply to comment #11)
> > libgsystem is not a compile time dependency; we don't link to runtime deps
> Okay, removed it in next patch (or should I put it somewhere else? Please
> advice)

We don't put that anywhere that would should be pulled in at runtime by distro deps.

> > Nitpick: MESSAGE_ID vs. MESSAGEID - consistency would be nice
> Fixed
> 
> > Also: we log() the same message in _initializeUI() (which should end up in the
> > journal as well), so probably a good idea to move that into an else block here.
> Done, though GNOME Shell used to log two messages - one for gdm mode and one
> for user mode. Now nothing will be logged for gdm mode - I hope it will not
> break anybody's code

I doubt any code uses that that's not really a documented API (or any API at all) so don't worry about that.
Comment 14 drago01 2014-04-28 16:47:44 UTC
Review of attachment 275364 [details] [review]:

::: js/ui/main.js
@@ +217,3 @@
+                                  GSystem.log_structured_print('GNOME Shell started at ' + _startDate,
+                                                               ['MESSAGE_ID=' + GNOMESHELL_STARTED_MESSAGE_ID]);
+                                  log('GNOME Shell started at ' + _startDate);

Well he said "in an else block" you are still logging it twice.
Comment 15 Vadim Rutkovsky 2014-04-28 16:50:24 UTC
(In reply to comment #14)
> Well he said "in an else block" you are still logging it twice.

Fixed and pushed as https://git.gnome.org/browse/gnome-shell/commit/?id=1c8036b8633b8de4f6d68127cb2fcbc64eef355b
Comment 16 Florian Müllner 2014-04-28 16:52:17 UTC
(In reply to comment #12)
> Done, though GNOME Shell used to log two messages - one for gdm mode and one
> for user mode.

No, those are two messages because two different processes log one message each.


> Now nothing will be logged for gdm mode

Not that I think it matters, but why? The gnome-shell process in the gdm session should still run this code on startup-complete as far as I can see.
Comment 17 Ting-Wei Lan 2014-05-02 13:55:33 UTC
libgsystem does not build or work on non-Linux system. Can we just copy necessary files (gsystem-log.[ch]) from libgsystem instead?
Comment 18 Florian Müllner 2014-05-02 14:29:17 UTC
(In reply to comment #17)
> libgsystem does not build or work on non-Linux system. Can we just copy
> necessary files (gsystem-log.[ch]) from libgsystem instead?

But that wouldn't work on non-Linux systems either, no? Given that GSystem is only needed when using systemd, we could just remove the unconditional import.
Comment 19 Ting-Wei Lan 2014-05-02 16:06:01 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > libgsystem does not build or work on non-Linux system. Can we just copy
> > necessary files (gsystem-log.[ch]) from libgsystem instead?
> 
> But that wouldn't work on non-Linux systems either, no? Given that GSystem is
> only needed when using systemd, we could just remove the unconditional import.

What you means is that we should check whether GSystem exists when importing it?
Comment 20 drago01 2014-05-02 16:51:30 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > (In reply to comment #17)
> > > libgsystem does not build or work on non-Linux system. Can we just copy
> > > necessary files (gsystem-log.[ch]) from libgsystem instead?
> > 
> > But that wouldn't work on non-Linux systems either, no? Given that GSystem is
> > only needed when using systemd, we could just remove the unconditional import.
> 
> What you means is that we should check whether GSystem exists when importing
> it?

Yes (check if systemd exists to be exact).
Comment 21 Florian Müllner 2014-05-02 16:56:33 UTC
(In reply to comment #19)
> What you means is that we should check whether GSystem exists when importing
> it?

Either that, or just don't import it before we reach the one place where we use it (in which case we are running under systemd).
Comment 22 Colin Walters 2014-05-03 17:35:07 UTC
(In reply to comment #21)
> (In reply to comment #19)
> > What you means is that we should check whether GSystem exists when importing
> > it?
> 
> Either that, or just don't import it before we reach the one place where we use
> it (in which case we are running under systemd).

That sounds good to me.
Comment 23 Florian Müllner 2014-05-03 19:07:03 UTC
Comment on attachment 275364 [details] [review]
Add a journald log entry with MESSAGE_ID if systemd is enabled

Attachment 275364 [details] was pushed as 1c8036b8633b a while ago, marking as such.
Comment 24 Florian Müllner 2014-05-03 19:12:10 UTC
Created attachment 275758 [details] [review]
main: Don't depend on GSystem unconditionally

We only need GSystem when running under systemd. As libgsystem itself
has a hard dependency on systemd, only import it when actually needed
to keep working on systems where systemd is not available.
Comment 25 drago01 2014-05-03 19:13:37 UTC
Review of attachment 275758 [details] [review]:

LG.
Comment 26 Florian Müllner 2014-05-03 21:55:49 UTC
Attachment 275758 [details] pushed as 8c45e6f - main: Don't depend on GSystem unconditionally