Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output logs to stdout/stderr only when run interactively #1935

Closed
1 task done
mbiebl opened this issue Jan 2, 2018 · 9 comments
Closed
1 task done

Output logs to stdout/stderr only when run interactively #1935

mbiebl opened this issue Jan 2, 2018 · 9 comments

Comments

@mbiebl
Copy link

mbiebl commented Jan 2, 2018

  • I have searched open and closed issues for duplicates

Bug description

Running signal-desktop, I get a load of message in my journal log which log like debug messages:

$ journalctl --user -b | grep signal-desktop.desktop | wc -l
720

An example message is

Jan 02 01:34:02 pluto signal-desktop.desktop[24590]: {"name":"log","hostname":"pluto","pid":24590,"level":30,"msg":"updating notifications - count: 0 focused:  enabled: true","time":"2018-01-02T00:34:02.738Z","v":0}

I'm not copying the full log, as I'm worried I miss something confidential.

Please consider tuning the log level, so those log messages are only printed when signal is started from a terminal

Platform info

Operating System: Linux, Debian sid, GNOME
Signal version: 1.1.0

@scottnonnenberg
Copy link
Contributor

Okay, let's take a couple steps back. It seems that you're starting Signal Desktop on launch of your system with systemd? And you're asking us not to print text to the stdout/stderr?

And your suggestion is to only output logs if we're connected to an interactive prompt? Maybe that is the right option, but I think we'd need an override for that, via a command-line switch.

@scottnonnenberg scottnonnenberg changed the title signal desktop very noisy/chatty, spams journal Output logs to stdout/stderr only when tty is interactive Jan 2, 2018
@scottnonnenberg scottnonnenberg changed the title Output logs to stdout/stderr only when tty is interactive Output logs to stdout/stderr only when run interactively Jan 2, 2018
@mbiebl
Copy link
Author

mbiebl commented Jan 2, 2018

Maybe a simpler solution is to have a --no-debug or --quiet switch and update /usr/share/applications/signal-desktop.desktop to use

Exec=/opt/Signal/signal-desktop --quiet %U

So if you start signal manually (from the command line), you get the chatty behaviour by default and if you start it via the desktop file (i.e. GNOME overview) you'd get the quiet behaviour

@ageis
Copy link

ageis commented Feb 19, 2018

@mbiebl I see it's going into your journal even though theres no service associated with it. IMO there should be!

My issue is there's no man page. I want to know what this stuff means and how I can toggle the environment variables to suppress that stuff:

NODE_ENV production
NODE_CONFIG_DIR /opt/Signal/resources/app.asar/config
NODE_CONFIG {}
ALLOW_CONFIG_MUTATIONS undefined
HOSTNAME undefined
NODE_APP_INSTANCE undefined
SUPPRESS_NO_CONFIG_WARNING undefined
setting AUMID to org.whispersystems.signal-desktop
userData: /home/kevin/.config/Signal

But since you have a .deb pkg, just add a systemd service unit, that captures the .Xauthority, and use debconf prompts upon configure/installation for the user it will be running as . Running signal-desktop under systemd, you can send StandardOutput/Error= to the journal or wherever. You can also harden and sandbox the app significantly, include an AppArmorProfile, have a private /tmp/, limit readonly/writeonly directories, etc. I compiled some heplful options: systemd service unit security hardening options

I've done .deb package before and can write the control scripts/ templates/ postinst/postrm so if you want to pursue this @scottnonnenberg I'm up for the task.

@mbiebl
Copy link
Author

mbiebl commented Feb 19, 2018

No, I'm not referring to a systemd service.
GNOME (or rather gdm3) set's up the session manager that output of programs goes to the journal:
https://bugzilla.gnome.org/show_bug.cgi?id=676181

As outlined earlier, I think the solution for this is, to provide a --quiet switch which is used inside the .desktop file. Or make the quiet mode the default and request the debug output via a --debug switch.

@dstensnes
Copy link

I'm also having some issues with this. I'm trying to find output from other programs in my ~/.xsession-errors file, but it's all drowning in debug output from signal-desktop and this is very annoying. I am using Debian Stretch, with this in my /etc/apt/sources.list.d/signal-xenial.list file which otherwise appears to be working okay:

deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main

I have tried to work around the problem by using this shell script:

#! /bin/sh
exec /usr/local/bin/signal-desktop &> $HOME/.output.signal

But that doesn't work either. Seems signal-desktop is restoring the output handles somehow?

Would you please consider something like a --debug option that can be enabled when you need it and not on by default?

@bit
Copy link

bit commented Feb 2, 2019

.desktop files log stdout to the journal. Singal needs a flag to not log that much info.
As a work around you can edit /usr/share/applications/signal-desktop.desktop
and change the Exec line to

Exec=bash -c '"/opt/Signal/signal-desktop" %U >/dev/null'
`

@mbiebl
Copy link
Author

mbiebl commented Feb 2, 2019

@bit just a word of warning, that on the next package update your change will be overwritten again.

I ended up doing the following:

$ cat ~/.local/share/applications/signal-desktop.desktop 
[Desktop Entry]
Name=Signal
Comment=Private messaging from your desktop
Exec=/usr/local/bin/signal-desktop-quiet %U
Terminal=false
Type=Application
Icon=signal-desktop
StartupWMClass=Signal
Categories=Network;

$ cat /usr/local/bin/signal-desktop-quiet 
#!/bin/sh
exec /opt/Signal/signal-desktop $@ >/dev/null

@stale
Copy link

stale bot commented Sep 28, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 28, 2021
@mbiebl
Copy link
Author

mbiebl commented Sep 28, 2021

It appears signal-desktop is a bit less chatty nowadays, but I still get stuff like

Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: NODE_ENV production
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: NODE_CONFIG_DIR /opt/Signal/resources/app.asar/config
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: NODE_CONFIG {}
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: ALLOW_CONFIG_MUTATIONS undefined
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: HOSTNAME undefined
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: NODE_APP_INSTANCE undefined
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: SUPPRESS_NO_CONFIG_WARNING undefined
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: SIGNAL_ENABLE_HTTP undefined
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: userData: /home/michael/.config/Signal
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: config/get: Successfully read user config file
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: Set Windows Application User Model ID (AUMID) { appUserModelId: 'org.whispersystems.signal-desktop' }
Sep 28 20:12:25 pluto signal-desktop.desktop[87626]: x-attr dependency did not load successfully
Sep 28 20:12:26 pluto signal-desktop.desktop[87626]: config/get: Successfully read ephemeral config file
Sep 28 20:12:26 pluto signal-desktop.desktop[87670]: libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
Sep 28 20:12:26 pluto signal-desktop.desktop[87626]: updateSchema:
Sep 28 20:12:26 pluto signal-desktop.desktop[87626]:   Current user_version: 40;
Sep 28 20:12:26 pluto signal-desktop.desktop[87626]:   Most recent db schema: 40;
Sep 28 20:12:26 pluto signal-desktop.desktop[87626]:   SQLite version: 3.34.1;
Sep 28 20:12:26 pluto signal-desktop.desktop[87626]:   SQLCipher version: 4.4.3 community;
Sep 28 20:12:26 pluto signal-desktop.desktop[87626]:   (deprecated) schema_version: 150;
Sep 28 20:12:28 pluto signal-desktop.desktop[87696]: (node:87696) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Sep 28 20:12:28 pluto signal-desktop.desktop[87696]: (Use `exe --trace-deprecation ...` to show where the warning was created)

in my journal whenever I start the application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants