-
Notifications
You must be signed in to change notification settings - Fork 205
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
Example: replacing NamedLoggerFactory #4045
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A ContextualizedLogger is a wrapper around an Slf4j logger. It uses call-by-name parameters to only construct logging lines when necessary. The underlying context can be used by invoking withoutContext. More interestingly, every call to one of its logging methods requires the presence of an implicit LoggingContext. A LoggingContext is a way of definining a set of pairs that a ContextualizedLogger can log without the need of it being specified for every call. A new context can be created with newLoggingContext and, given an implicit LoggingContext, pairs can be added or overwritten using withEnrichedLoggingContext. Pairs in the context will be appended to each event logged by a ContextualizedLogger in the following form: some text logged explicitly (context: {key1=value1, key2=value2) If the underlying Logger is configured to use the Logstash encoder the keys and values in the LoggingContext will also be added to the logging event encoded in JSON format. CHANGELOG_BEGIN CHANGELOG_END
SamirTalwar
reviewed
Jan 15, 2020
...-state/kvutils/app/src/main/scala/com/daml/ledger/participant/state/kvutils/app/Runner.scala
Show resolved
Hide resolved
ledger/sandbox/src/main/scala/com/digitalasset/platform/indexer/RecoveringIndexer.scala
Show resolved
Hide resolved
ledger/sandbox/src/main/scala/com/digitalasset/platform/indexer/StandaloneIndexerServer.scala
Show resolved
Hide resolved
ledger/sandbox/src/main/scala/com/digitalasset/platform/apiserver/LedgerApiServer.scala
Show resolved
Hide resolved
.../src/main/scala/com/digitalasset/platform/apiserver/services/ApiActiveContractsService.scala
Show resolved
Hide resolved
stefanobaghino-da
changed the title
Example: replacing NamedLoggerFactory
Replace NamedLoggerFactory
Jan 17, 2020
11 tasks
Superseded by #4097. |
stefanobaghino-da
changed the title
Replace NamedLoggerFactory
Example: replacing NamedLoggerFactory
Jan 17, 2020
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 17, 2020
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 17, 2020
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 17, 2020
Address #4045 (comment) Address #4045 (comment)
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 17, 2020
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 17, 2020
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 17, 2020
Address #4045 (comment) Address #4045 (comment)
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 20, 2020
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 20, 2020
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 20, 2020
Address #4045 (comment) Address #4045 (comment)
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 20, 2020
The generation of code to have logging in the services has been replaced by helpers classes. This will allow to enrich the context received at construction by the service implementations.
stefanobaghino-da
added a commit
that referenced
this pull request
Jan 21, 2020
* Replace NamedLoggerFactory CHANGELOG_BEGIN CHANGELOG_END * Recover change lost in rebase * Address #4045 (comment) * Address #4045 (comment) * Address two open review comments Address #4045 (comment) Address #4045 (comment) * Address outstanding compilation errors * Replace mocking with in-memory log collector * Address #4097 (review) * Address #4045 (comment) The generation of code to have logging in the services has been replaced by helpers classes. This will allow to enrich the context received at construction by the service implementations. * Use ContextualizedLogger for TrackerMap * Remove deleted logging packages from artifacts.yaml * Remove remaining deleted artifact from artifacts.yaml * Address #4097 (comment) * Address #4097 (comment) * Address #4097 (comment) * Address #4097 (comment) * Annotate type of references to logErrorOnCall * Address #4097 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is meant mostly as an example of how the
ContextualizedLogger
/LoggingContext
would be used to replace theNamedLoggerFactory
.ApiSubmissionService
in particular shows a simple example of enriching theLoggingContext
(in particular with the command identifier).Note that all services that use the
LoggingServiceMarker
to automatically generating code that logs internal and unknown gRPC errors has not been ported yet, I'm currently working on it.Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.