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

fix: propagate log-config changes #12566

Merged

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented May 25, 2023

If Theia is started with the "--log-config" option the 'LogLevelCliContribution' watches for file changes and fires a 'logConfigChangedEvent'. This event was not listened to. Therefore already existing 'ILogger' levels were not updated. This is now fixed.

Contributed on behalf of STMicroelectronics

What it does

Installs a listener in the console-logger-server to update log levels when the log config file changes

How to test

Create a log config file and start Theia with the --log-config option, e.g. theia start --log-config=logConfig.json.

Example log config:

{
    "defaultLevel": "info",
    "levels": {
        "task": "warn"
    }
}

While Theia is running modify the handed over log config file (e.g. change the defaultLevel to warn or fatal) and observe that from then on the log messages are filtered accordingly.

Review checklist

Reminder for reviewers

@sdirix sdirix force-pushed the propagate-log-config-changes branch 2 times, most recently from f8c598f to 4879567 Compare May 26, 2023 06:20
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

Alright, looks good to me 👍

packages/core/src/node/console-logger-server.ts Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@vince-fugnitto vince-fugnitto added the logging issues related to logging label Aug 3, 2023
@sdirix sdirix force-pushed the propagate-log-config-changes branch 3 times, most recently from 0abdec7 to d469f92 Compare September 4, 2023 13:34
@sdirix
Copy link
Member Author

sdirix commented Sep 4, 2023

I noticed that the frontend loggers were correctly updated with the PR, however the backend loggers were not. I reworked the PR a bit for a cleaner architecture including getting rid of a pre-existing FIXME. Now both kind of loggers are correctly updated.

@sdirix sdirix requested a review from msujew September 4, 2023 13:37
@JonasHelming
Copy link
Contributor

@msujew Ping? :-)

@sdirix sdirix force-pushed the propagate-log-config-changes branch from d469f92 to 8ed7854 Compare September 25, 2023 11:31
@sdirix
Copy link
Member Author

sdirix commented Sep 25, 2023

Rebased the PR on the latest state of master

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

Alright the new changes look good to me as well 👍

packages/core/src/common/logger-watcher.ts Outdated Show resolved Hide resolved
If Theia is started with the "--log-config" option the 'LogLevelCliContribution' watches
for file changes and fires a 'logConfigChangedEvent'. This event was not listened to.
Therefore already existing 'ILogger' levels were not updated. This is now fixed by
notifying loggers about log config changes to update their log level.

Also refactors the backend architecture to also use the existing client mechanism for
notifications.

Signed-off-by: Stefan Dirix <sdirix@eclipsesource.com>

Contributed on behalf of STMicroelectronics
@sdirix sdirix force-pushed the propagate-log-config-changes branch from 8ed7854 to 8f1ae28 Compare September 26, 2023 13:20
@msujew msujew merged commit fcde5ea into eclipse-theia:master Sep 26, 2023
10 of 12 checks passed
@vince-fugnitto vince-fugnitto added this to the 1.42.0 milestone Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging issues related to logging
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants