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

Unexpected suffix in log messages #299

Open
paulgeiger-eng opened this issue Nov 5, 2021 · 0 comments
Open

Unexpected suffix in log messages #299

paulgeiger-eng opened this issue Nov 5, 2021 · 0 comments
Labels
P3 type=defect Bug, not working as expected

Comments

@paulgeiger-eng
Copy link

After upgrade from flogger 0.6 to flogger 0.7.1 I am observing an unexpected suffix in our log messages. We are using flogger-system-backend and flogger-grpc-context maven dependencies.

We are using context based log levels. We have code like:

final var logLevelMap = buildLogLevelMap();
ScopedLoggingContext.getInstance()
.newContext()
.withLogLevelMap(logLevelMap)
.install();

For example if I have a log statement like:

log.atFine().log("My message");

Then I will see the log record message as "My message [CONTEXT forced=true ]".

I have made a couple observations from the debugger:

  1. GrpcContextData::shouldForceLoggingFor method seems to return true for all cases where the message should be logged according the the log level map, regardless of whether the message would have been logged anyway according to system log levels. So once we start using the log level map I am seeing the suffix get added for every single log message.
  2. LogContext constructor calls an addMetadata method when the isForced parameter is true. It seems like it is this "metadata" that is being appended as a suffix to all the log messages.

I don't think that appending a suffix to all the log messages should be the default behavior when using context based log level maps.

Is there a way to turn off the suffix?

@chaoren chaoren added P3 type=defect Bug, not working as expected labels Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 type=defect Bug, not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants