Structured logging with ClientLogger#25247
Conversation
|
API changes have been detected in |
1 similar comment
|
API changes have been detected in |
8307552 to
a098062
Compare
|
API changes have been detected in |
a098062 to
e705725
Compare
|
API changes have been detected in |
|
With this change we now support 2 ways to log (Fluent vs non-fluent) - should we long term consolidate to only one style? |
It's possible we could do this, but in terms of backwards compatibility, I wouldn't worry too much. This is exactly the pattern SLF4J is taking in its 2.0.0 release. |
JonathanGiles
left a comment
There was a problem hiding this comment.
Looking really promising!
sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/logging/LoggingEventBuilder.java
Outdated
Show resolved
Hide resolved
I meant should we think of only exposing Fluent way of doing things moving forward (whenever we think it is the right time) ? I understand our ecosystem supports multiple ways of doing the same thing but shouldn't our SDKs have a single way of doing everything. |
|
@lmolkova this is pretty cool. I love how you are adding benchmarks to the PRs. |
Fluent way is a bit less performant (you have to allocate the builder), a bit more verbose ( |
c48d9c3 to
6a2d3df
Compare
a19ceda to
00d00b3
Compare
sdk/core/azure-core/src/main/java/com/azure/core/implementation/logging/LoggingUtil.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/util/logging/LoggingEventBuilder.java
Outdated
Show resolved
Hide resolved
00d00b3 to
fc7aa8f
Compare
|
Fresh benchmark, ~same results |
Description: https://gist.github.com/lmolkova/04f6484595fdd7edded9f4d82619291f
Inspired by SLF4J v2 API
Usage
Outcome:
2021-11-08 15:04:42.407 [ForkJoinPool-1-worker-3] [WARN] com.azure.core.util.logging.ClientLoggerTests - hello, argument = 1, az.sdk.context={"connectionId":"foo", "linkName":"bar"}Micro-benchmarks:
Fluent pattern (
loggingAtEnabledLevelWithContext) vs explicit context (loggingAtEnabledLevelWithContext2) don't show significant difference in perf: