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

Change log level on several status messages (Fixes #652, Fixes #516) #664

Merged
merged 3 commits into from
May 12, 2020

Conversation

simons-public
Copy link

This changes the log level for several statuses (started server, connected to server, server status:) from CLOG_NOTE or CLOG_INFO to CLOG_PRINT so they will be printed to stdout regardless of the log level. This allows the GUI to accurately report the status of the barriers or barrierc processes in MainWindow.cpp#L379-L399

Until the IPC connection state messages are implemented this should fix any issues with the GUI not reporting the correct status.

Example output with this change running barriers (and ignoring TIS/TSM #653)

./build/bin/barriers -f --no-tray --debug WARNING --name <hostname> --enable-drag-drop --enable-crypto -c  <config>  --address :24800 2>&1 | egrep -v TSM
started server (IPv4/IPv6), waiting for clients
debauchee#516)

This changes the log level for several statuses (started server,
connected to server, server status:) from CLOG_NOTE or CLOG_INFO to
CLOG_PRINT so they will be printed to stdout regardless of the log
level. This allows the GUI to accurately report the status of the
`barriers` or `barrierc` processes in src/gui/src/MainWindow.cpp#L379-L399.
@plessbd
Copy link

plessbd commented May 12, 2020

confirm that this works as expected. But made it more obvious that https://github.com/debauchee/barrier/blob/master/src/gui/src/MainWindow.cpp#L539-L548 output the following no matter the level

[2020-05-12T08:35:22] INFO: starting server
[2020-05-12T08:35:22] INFO: config file: /private/var/folders/gx/6jwb8yzj4fd29jcf_syprmf80000gn/T/Barrier.cDPCLw
[2020-05-12T08:35:22] INFO: log level: WARNING

by more obvious, I mean looking at the logs while testing the levels made it obvious that the INFO is prefixed at any level

@shymega shymega self-requested a review May 12, 2020 15:16
@shymega
Copy link

shymega commented May 12, 2020

@plessbd I'm not quite sure what you mean.. could you explain a bit more in depth? Cheers.

@plessbd
Copy link

plessbd commented May 12, 2020

It is not related to this change, it was just that while I was testing this and was looking more closely at the logs.

Even though I have the log level set to WARNING, it is still outputting things at INFO. Those lines are outputting 'INFO' even though my error level is set to WARNING and they should not be being shown

And looking at the code it doesnt care what the log level is on those lines, it just writes to the info logger

or now that I look at the code more, only the appendLogDebug function checks the log level before writing, the others do not https://github.com/debauchee/barrier/blob/master/src/gui/src/MainWindow.cpp#L346-L360

I am testing the following diff and will put in a PR if it does what I think it "should"

diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp
index 79faf59f..7fea19b4 100644
--- a/src/gui/src/MainWindow.cpp
+++ b/src/gui/src/MainWindow.cpp
@@ -345,7 +345,9 @@ void MainWindow::logError()

 void MainWindow::appendLogInfo(const QString& text)
 {
-    m_pLogWindow->appendInfo(text);
+    if (appConfig().logLevel() >= 3) {
+        m_pLogWindow->appendInfo(text);
+    }
 }

 void MainWindow::appendLogDebug(const QString& text) {
@@ -536,10 +538,7 @@ void MainWindow::startBarrier()

     qDebug() << args;

-    // show command if debug log level...
-    if (appConfig().logLevel() >= 4) {
-        appendLogInfo(QString("command: %1 %2").arg(app, args.join(" ")));
-    }
+    appendLogDebug(QString("command: %1 %2").arg(app, args.join(" ")));

     appendLogInfo("config file: " + configFilename());
     appendLogInfo("log level: " + appConfig().logLevelText());
@simons-public
Copy link
Author

@shymega I think what plessbd is talking about is that when running the client in the GUI it still shows a couple of INFO log level messages before it changes to what it is set to. Here's an example from my server running with this pull:

[2020-05-12T09:02:36] INFO: starting server
[2020-05-12T09:02:36] INFO: config file: /private/var/folders/bh/9j4m2v653fs0z6wx98d7433r0000gn/T/Barrier.hJEeHC
[2020-05-12T09:02:36] INFO: log level: WARNING
started server (IPv4/IPv6), waiting for clients
@shymega
Copy link

shymega commented May 12, 2020

OK. Thanks.

Just want to recommend checking out #669, and see if both of your patches conflict with that.
Ideally, I'd like to merge one PR with a cumulative set of changes, rather than 3 separate PRs.

@simons-public
Copy link
Author

@shymega I checked out #669, I think it's a good addition and doesn't conflict with this.
It looks like #654 was closed in favor of this and #669.

Fix a few more log messages to be consistent
@plessbd
Copy link

plessbd commented May 12, 2020

I am fine with merging #669 and this one, I submitted a PR to @simons-public on this branch if we want to merge them. Or he can make the changes, whatever is easiest.

A few more log cleanups
@simons-public
Copy link
Author

@shymega I merged the pull request from @plessbd so it can be merged as one PR.

Copy link

@shymega shymega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections from me. 👍

@shymega shymega merged commit dc2869f into debauchee:master May 12, 2020
@shymega
Copy link

shymega commented May 12, 2020

Merging this PR. Fixes #669 by extension.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
4 participants