Skip to content

admin: Change multiple log levels at once - #19868

Merged
mattklein123 merged 33 commits into
envoyproxy:mainfrom
timonwong:admin-multi-log-levels
Feb 18, 2022
Merged

mattklein123 merged 33 commits into
envoyproxy:mainfrom
timonwong:admin-multi-log-levels

Conversation

@timonwong

@timonwong timonwong commented Feb 8, 2022 •

Copy link
Copy Markdown
Contributor

Signed-off-by: Tianpeng Wang [email protected]

Commit Message: admin: Change multiple log levels at once
Additional Description:
Risk Level: Low
Testing: unit tests, integration tests
Docs Changes: Required
Release Notes: Required
Platform Specific Features: N/A

@repokitteh-read-only

Copy link
Copy Markdown

Hi @timonwong, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #19868 was opened by timonwong.

see: more, trace.

@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #19868 was opened by timonwong.

see: more, trace.

@timonwong
timonwong force-pushed the admin-multi-log-levels branch from d11ea58 to ba441db Compare February 8, 2022 08:39
@timonwong
timonwong marked this pull request as ready for review February 8, 2022 08:54
@timonwong timonwong closed this Feb 8, 2022
@timonwong timonwong reopened this Feb 8, 2022
@daixiang0

Copy link
Copy Markdown
Member

Need maintainer to trigger CI.

/cc @envoyproxy/first-pass-reviewers

Comment thread source/server/admin/logs_handler.cc Resolved
Comment thread source/server/admin/logs_handler.cc Resolved
Comment thread source/server/admin/logs_handler.cc Resolved
@timonwong
timonwong force-pushed the admin-multi-log-levels branch 4 times, most recently from ff23dee to 47a0cbc Compare February 9, 2022 09:24
@timonwong
timonwong force-pushed the admin-multi-log-levels branch 4 times, most recently from 40b6d5d to 98f91f9 Compare February 9, 2022 14:25
@timonwong

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Check envoy-presubmit didn't fail.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19868 (comment) was created by @timonwong.

see: more, trace.

@timonwong
timonwong force-pushed the admin-multi-log-levels branch from 98f91f9 to 6d69969 Compare February 9, 2022 15:43
@timonwong

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19868 (comment) was created by @timonwong.

see: more, trace.

@timonwong

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19868 (comment) was created by @timonwong.

see: more, trace.

Signed-off-by: Tianpeng Wang <[email protected]>
@timonwong

Copy link
Copy Markdown
Contributor Author

/wait

Signed-off-by: Tianpeng Wang <[email protected]>
Signed-off-by: Tianpeng Wang <[email protected]>
Signed-off-by: Tianpeng Wang <[email protected]>
@timonwong

timonwong commented Feb 16, 2022 •

Copy link
Copy Markdown
Contributor Author

I have to rebase due to DCO, from commit 9f2ff56

@timonwong
timonwong force-pushed the admin-multi-log-levels branch from 256d7e3 to 8e33b45 Compare February 16, 2022 04:48
Signed-off-by: Tianpeng Wang <[email protected]>
@timonwong

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19868 (comment) was created by @timonwong.

see: more, trace.

Signed-off-by: Tianpeng Wang <[email protected]>
@timonwong
timonwong force-pushed the admin-multi-log-levels branch from 37ff448 to 384224f Compare February 16, 2022 06:18
jmarantz
jmarantz previously approved these changes Feb 17, 2022

@jmarantz jmarantz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for doing all this! I left notes on a few minor nits. I'll pass this off to senior maintainers.

/assign-from @envoyproxy/senior-maintainers

Comment thread source/server/admin/logs_handler.cc Outdated

void LogsHandler::changeAllLogLevels(spdlog::level::level_enum level) {
if (!Logger::Context::useFancyLogger()) {
ENVOY_LOG(debug, "change all log levels: level='{}'", spdlog::level::level_string_views[level]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Scanning over the file at HEAD it's not consistent. Can you make all the similar messages be the same level? I'd go for debug for now:

FANCY_LOG(info, "change all log levels: level='{}'", level);

FANCY_LOG(info, "change log level: name='{}' level='{}'", name, level);

namespace {

// NOLINTNEXTLINE(readability-identifier-naming)
std::string ContentType(const BufferingStreamDecoderPtr& response) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename to contentType and drop the lint override. Also it could return a string_view rather than copying into a string.

I realize you are just moving the pre-existing code but it's being looked at through a new lens of code standards and lint tools :)

thanks :)

Comment thread test/server/admin/logs_handler_test.cc Outdated
EXPECT_EQ(getFancyContext().getFancyLogEntry(__FILE__)->level(), spdlog::level::info);

// Test multiple log levels at once
std::string file = "xxxx_test_logger_file_xxxx";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const

@repokitteh-read-only

Copy link
Copy Markdown

@envoyproxy/senior-maintainers assignee is @mattklein123

🐱

Caused by: a #19868 (review) was submitted by @jmarantz.

see: more, trace.

1. `POST /logging`: List all names (i.e. file paths) of all active loggers and their levels;
2. `POST /logging?<file_path>=<level>`: Given the current file path, change the log level of the file;
3. `POST /logging?level=<level>`: Change levels of all loggers.
3. `POST /logging?paths=file_path1:level1,file_path2:level2...`: Change log level of multiple file paths at once;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this also be documented in the non-fancy-logger doc?

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks LGTM at a high level with some very small comments.

/wait

Comment thread docs/root/version_history/current.rst Resolved
Comment thread source/server/admin/logs_handler.cc Outdated

void LogsHandler::changeAllLogLevels(spdlog::level::level_enum level) {
if (!Logger::Context::useFancyLogger()) {
ENVOY_LOG(debug, "change all log levels: level='{}'", spdlog::level::level_string_views[level]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think log level change notifications at info level is reasonable so people can see it in the logs? Let's use info?

Signed-off-by: Tianpeng Wang <[email protected]>
Signed-off-by: Tianpeng Wang <[email protected]>

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@mattklein123
mattklein123 enabled auto-merge (squash) February 18, 2022 02:11
@mattklein123
mattklein123 merged commit 53eca80 into envoyproxy:main Feb 18, 2022
@timonwong
timonwong deleted the admin-multi-log-levels branch February 18, 2022 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants