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

[0.13] logger: Make output to syslog nicer #472

Merged
merged 2 commits into from
Feb 14, 2019

Conversation

digitalcircuit
Copy link
Contributor

@digitalcircuit digitalcircuit commented Jan 29, 2019

In short

  • Improves Quassel's --syslog output
    • Removes redundant log level messages, e.g. [Info]
    • Adds PID
  • Deduplicate code for converting LogEntry to printable format
Criteria Rank Reason
Impact ★☆☆ 1/3 Improves log handling for --syslog, including systemd
Risk ★☆☆ 1/3 Logging might be wrongly formatted or not logged at all
Intrusiveness ★☆☆ 1/3 Small changes, shouldn't interfere with other pull requests

All credit to @vehk for the original work, this is just testing and an additional fix.

Rationale

See the master branch pull request #460, "Make output to syslog nicer".

Example

Before

Before: 2019-01-11T22:52:27+00:00 hostname info [Info ] Quitting...

After

After: 2019-01-11T16:19:43+00:00 hostname info quasselcore[4438]: Quitting...

Additional testing with Qt 4, Qt 5, systemd

Qt 5

Screenshot of Quassel client and Quassel core running on Qt 5, showing various debug logs in terminal windows and the 'Debug Log' window.  See below quotes for text.

Client Debug Log dialog

2019-02-13 19:20:08 [Debug] Enabling compression...
2019-02-13 19:20:08 [Debug] Using the DataStream protocol...
2019-02-13 19:20:08 [Debug] Starting encryption...
2019-02-13 19:24:05 [Debug] Enabling compression...
2019-02-13 19:24:05 [Debug] Using the DataStream protocol...
2019-02-13 19:24:05 [Debug] Starting encryption...

Client launch command and logging in terminal window

sly@kyuubi-desktop:~/Source/Chat/Quassel/scripts$ ./run-quasselclient.sh --loglevel Debug
Quassel version: '/home/sly/Source/Chat/Quassel/quassel-build/quasselclient', in 'config_client'
2019-02-13 19:20:08 [Debug] Enabling compression...
2019-02-13 19:20:08 [Debug] Using the DataStream protocol...
2019-02-13 19:20:08 [Debug] Starting encryption...
2019-02-13 19:24:05 [Debug] Enabling compression...
2019-02-13 19:24:05 [Debug] Using the DataStream protocol...
2019-02-13 19:24:05 [Debug] Starting encryption...

Core launch command and logging in terminal window

sly@kyuubi-desktop:~/Source/Chat/Quassel/scripts$ ./run-quasselcore.sh --loglevel Debug --syslog
Quassel version: '/home/sly/Source/Chat/Quassel/quassel-build/quasselcore', in 'config_core'
sly@kyuubi-desktop:~/Source/Chat/Quassel/scripts$

Core logging to file

2019-02-13 19:21:40 [Info ] Core shutting down... 
2019-02-13 19:21:40 [Info ] Core shutdown complete! 
2019-02-13 19:24:05 [Warn ] SslServer: Certificate expired on Fri Jun 8 19:26:17 2018 GMT 
2019-02-13 19:24:05 [Warn ] SslServer: Certificate expired on Fri Jun 8 19:26:17 2018 GMT 
2019-02-13 19:24:05 [Info ] SQLite storage backend is ready. Schema version: 31 
2019-02-13 19:24:05 [Info ] Database authenticator is ready. 
2019-02-13 19:24:05 [Info ] Listening for GUI clients on IPv6 :: port 4242 using protocol version 10 
2019-02-13 19:24:05 [Info ] Listening for GUI clients on IPv4 0.0.0.0 port 4242 using protocol version 10 
2019-02-13 19:24:05 [Info ] Restoring previous core state... 
2019-02-13 19:24:05 [Info ] Client connected from 127.0.0.1 
2019-02-13 19:24:05 [Debug] Enabling compression...
2019-02-13 19:24:05 [Debug] Using the DataStream protocol...
2019-02-13 19:24:05 [Debug] Starting encryption for Client: "127.0.0.1"
2019-02-13 19:24:05 [Info ] Client 127.0.0.1 initialized and authenticated successfully as "dcircuit" (UserId: 1). 
2019-02-13 19:24:25 [Info ] Caught signal 2 
2019-02-13 19:24:25 [Info ] Quitting... 
2019-02-13 19:24:25 [Info ] Core shutting down... 
2019-02-13 19:24:25 [Info ] Core shutdown complete!

Core logging to syslog (systemd journalctl output)

Sections wrapped with <bold>…</bold> are printed in bold in the terminal, indicating warning level. This is customizable.

Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: <bold>SslServer: Certificate expired on Fri Jun 8 19:26:17 2018 GMT</bold>
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: <bold>SslServer: Certificate expired on Fri Jun 8 19:26:17 2018 GMT</bold>
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: SQLite storage backend is ready. Schema version: 31
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Database authenticator is ready.
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Listening for GUI clients on IPv6 :: port 4242 using protocol version 10
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Listening for GUI clients on IPv4 0.0.0.0 port 4242 using protocol version 10
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Restoring previous core state...
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Client connected from 127.0.0.1
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Enabling compression...
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Using the DataStream protocol...
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Starting encryption for Client: "127.0.0.1"
Feb 13 19:24:05 kyuubi-desktop quasselcore[12315]: Client 127.0.0.1 initialized and authenticated successfully as "dcircuit" (UserId: 1).
Feb 13 19:24:25 kyuubi-desktop quasselcore[12315]: Caught signal 2
Feb 13 19:24:25 kyuubi-desktop quasselcore[12315]: Quitting...
Feb 13 19:24:25 kyuubi-desktop quasselcore[12315]: Core shutting down...
Feb 13 19:24:25 kyuubi-desktop quasselcore[12315]: Core shutdown complete!

Qt 4

Screenshot of Quassel client and Quassel core running on Qt 4, showing various debug logs in terminal windows and the 'Debug Log' window.  See below quotes for text.

Client Debug Log dialog

2019-02-13 19:40:08 [Warn ] Missing icon: "{inactive-quassel}"
2019-02-13 19:40:08 [Warn ] Missing icon: "{connect-quassel}"
2019-02-13 19:40:08 [Warn ] Missing icon: "{disconnect-quassel}"
2019-02-13 19:40:08 [Warn ] Missing icon: "{inactive-quassel-tray}"
2019-02-13 19:40:08 [Debug] Enabling compression... 
2019-02-13 19:40:08 [Debug] Using the DataStream protocol...
2019-02-13 19:40:08 [Debug] Starting encryption... 
2019-02-13 19:40:08 [Warn ] Missing icon: "{active-quassel-tray}"

Client launch command and logging in terminal window

sly@kyuubi-desktop:~/Source/Chat/Quassel/scripts$ ./run-quasselclient.sh --loglevel=Debug
Quassel version: '/home/sly/Source/Chat/Quassel/quassel-build/quasselclient', in 'config_client'
2019-02-13 19:40:08 [Warn ] Missing icon: "{inactive-quassel}"
2019-02-13 19:40:08 [Warn ] Missing icon: "{connect-quassel}"
2019-02-13 19:40:08 [Warn ] Missing icon: "{disconnect-quassel}"
2019-02-13 19:40:08 [Warn ] Missing icon: "{inactive-quassel-tray}"
2019-02-13 19:40:08 [Debug] Enabling compression... 
2019-02-13 19:40:08 [Debug] Using the DataStream protocol...
2019-02-13 19:40:08 [Debug] Starting encryption... 
2019-02-13 19:40:08 [Warn ] Missing icon: "{active-quassel-tray}"

Core launch command and logging in terminal window

sly@kyuubi-desktop:~/Source/Chat/Quassel/scripts$ ./run-quasselcore.sh --loglevel=Debug --syslog
Quassel version: '/home/sly/Source/Chat/Quassel/quassel-build/quasselcore', in 'config_core'

Core logging to file

2019-02-13 19:40:03 [Warn ] SslServer: Certificate expired on Fri Jun 8 19:26:17 2018 
2019-02-13 19:40:03 [Warn ] SslServer: Certificate expired on Fri Jun 8 19:26:17 2018 
2019-02-13 19:40:03 [Warn ] PostgreSQL driver plugin not available for Qt. Installed drivers: QSQLITE 
2019-02-13 19:40:03 [Info ] SQLite storage backend is ready. Schema version: 31 
2019-02-13 19:40:03 [Info ] Database authenticator is ready. 
2019-02-13 19:40:03 [Info ] Listening for GUI clients on IPv6 :: port 4242 using protocol version 10 
2019-02-13 19:40:03 [Info ] Restoring previous core state... 
2019-02-13 19:40:08 [Info ] Client connected from ::FFFF:7F00:1%0 
2019-02-13 19:40:08 [Debug] Enabling compression... 
2019-02-13 19:40:08 [Debug] Using the DataStream protocol...
2019-02-13 19:40:08 [Debug] Starting encryption for Client: "::FFFF:7F00:1%0" 
2019-02-13 19:40:08 [Info ] Client ::FFFF:7F00:1%0 initialized and authenticated successfully as "dcircuit" (UserId: 1).

Core logging to syslog (systemd journalctl output)

Sections wrapped with <bold>…</bold> are printed in bold in the terminal, indicating warning level. This is customizable.

Feb 13 19:40:03 kyuubi-desktop quasselcore[15371]: <bold>SslServer: Certificate expired on Fri Jun 8 19:26:17 2018</bold>
Feb 13 19:40:03 kyuubi-desktop quasselcore[15371]: <bold>SslServer: Certificate expired on Fri Jun 8 19:26:17 2018</bold>
Feb 13 19:40:03 kyuubi-desktop quasselcore[15371]: <bold>PostgreSQL driver plugin not available for Qt. Installed drivers: QSQLITE</bold>
Feb 13 19:40:03 kyuubi-desktop quasselcore[15371]: SQLite storage backend is ready. Schema version: 31
Feb 13 19:40:03 kyuubi-desktop quasselcore[15371]: Database authenticator is ready.
Feb 13 19:40:03 kyuubi-desktop quasselcore[15371]: Listening for GUI clients on IPv6 :: port 4242 using protocol version 10
Feb 13 19:40:03 kyuubi-desktop quasselcore[15371]: Restoring previous core state...
Feb 13 19:40:08 kyuubi-desktop quasselcore[15371]: Client connected from ::FFFF:7F00:1%0
Feb 13 19:40:08 kyuubi-desktop quasselcore[15371]: Enabling compression...
Feb 13 19:40:08 kyuubi-desktop quasselcore[15371]: Using the DataStream protocol...
Feb 13 19:40:08 kyuubi-desktop quasselcore[15371]: Starting encryption for Client: "::FFFF:7F00:1%0"
Feb 13 19:40:08 kyuubi-desktop quasselcore[15371]: Client ::FFFF:7F00:1%0 initialized and authenticated successfully as "dcircuit" (UserId: 1).

digitalcircuit pushed a commit to digitalcircuit/quassel that referenced this pull request Jan 29, 2019
Resolve the level string in msgWithTime.  This means that the log
level string is included in logs to files and stdout even if syslog
output is enabled.

Closes quasselGH-472
@digitalcircuit
Copy link
Contributor Author

Once pull request #460 has been updated, I'll update this here. Alternatively, if I'm not available in time, I've left the Allow edits from maintainers checkbox enabled.

Resolve the level string in msgWithTime.  This means that the log
level string is included in logs to files and stdout even if syslog
output is enabled.

Resolve the program name using RunMode and BuildInfo, distinguishing
between client, core, and monolithic.

[Backported from 0.14/git-master]
Deduplicate code by moving LogEntry formatting into a separate
function, LogEntry::toString(), which applies timestamps and the log
level string.

Fix client Debug Log dialog to print log level using this new function.

Modify msgWithTime() to use this new function, too.
@digitalcircuit digitalcircuit changed the title [0.13] logger: Make output to syslog nicer [backport 0.13] logger: Make output to syslog nicer Feb 14, 2019
@digitalcircuit
Copy link
Contributor Author

This pull request has been updated with the changes in pull request #460, as well as an additional fix on top. It should be ready for merging.

@digitalcircuit digitalcircuit changed the title [backport 0.13] logger: Make output to syslog nicer [0.13] logger: Make output to syslog nicer Feb 14, 2019
@Sput42 Sput42 merged commit 3c910a4 into quassel:0.13 Feb 14, 2019
@digitalcircuit digitalcircuit deleted the backport-0.13-vehk-syslog-fixes branch June 14, 2019 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants