Comments (1)
Determine how we want to JSON structured logging to look like
There are two options:
-
Don't change anything for SLF4J 2.0. As a result, SLF4J 2.0 providers would get string message (which happens to be structured json) and won't see individual key-value-pairs
- Pros: when writing logs to file/console, the default formatter would print log message as a whole.
- Cons: when writing logs to structured destinations, the message will remain a string and will need additional parsing when querying data
-
Leverage the structure and use SLF4J 2.0
addKeyValue
methods to provide the context to the SDLF4J- Pros: when writing logs to structured destinations, users will get better experience
- Cons: when writing to file/console, the default formatters will NOT include any context. And would just print the message
The middle ground:
E.g. we want to record the following log: connectionId=foo, error.type=canceled, message="Connection attempt failed"
With SLF4J 1.7 we record message as {"connectionId":"foo", "error.type":"canceled", "message":"Connection attempt failed"}
With SLF4J 2.0 we record structured things and a formatted message like
slf4JLogger.atInfo()
.addKeyValue("connectionId", "foo")
.addKeyValue("error.type", "canceled")
.addKeyValue("message", "Connection attempt failed")
.log("{\"connectionId\":\"foo\", \"error.type\":\"canceled\", \"message\":\"Connection attempt failed\"}")
This would be a default behavior resulting in:
- giving all the structure to providers that support it
- still having all the context and message in the formatted json string in the message for default formatters.
It'd result in duplication and we can consider letting users to configure it.
My proposal is to do 1.5 eventually, but stick with option 1 for now until we have any feedback/scenario for option 1.5.
By doing option 1, we effectively do
slf4JLogger.atInfo()
.log("{\"connectionId\":\"foo\", \"error.type\":\"canceled\", \"message\":\"Connection attempt failed\"}")
and
.addKeyValue("connectionId", "foo")
.addKeyValue("error.type", "canceled")
.addKeyValue("message", "Connection attempt failed")
is purely incremental change.
from azure-sdk-for-java.
Related Issues (20)
- [OpenAI][Assistants] Add custom code for `uploadFile` for server requirement for `filename`
- Legacy flag for the Java SDK HOT 2
- sdk/cosmos/azure-cosmos-spark_3-5_2-12 - "_corrupt_record" column isn't getting populated when reading from Cosmos DB HOT 5
- [BUG] Different embedding 3 vectors in Azure vs. OpenAI HOT 3
- User can't manage the lifecycle of THREAD_POOL in Azure Table Storage Java SDK HOT 2
- [BUG] Azure SQL ActiveDirectoryManagedIdentity authentication with sleuth HOT 3
- Is it missing partial update function for blob HOT 7
- [Text Translation] Use the latest test proxy
- [BUG] Unable to list Virtual Networks in an Subscription HOT 4
- [FEATURE REQ] [OpenAI Client] Feature parity with official Python client (and also fully support vLLM) HOT 1
- [QUERY] How can we update a deployment using createOrUpdateDeploymentWithResponse API? HOT 1
- mgmt, fix TypeSpec generation/sdk automation script
- [BUG] Javadoc for RequestRetryOptions may be incorrect or misleading HOT 2
- [FEATURE REQ] Add @ServiceConnection support for CosmosDB, EventHub and Azurite HOT 5
- [BUG] Embedding model input parameter support. HOT 6
- Spring Boot 3.3.0 support HOT 12
- Java SDK encodes the blob name (.NET & Nodejs are preserving the slashes) HOT 2
- Add API to set query parameters on HttpRequestInformation
- [BUG] Azure data table client listEntities API return string instead of binary data (breaking change & bug) HOT 3
- [FEATURE REQ] Implement equals properly on ChatCompletionsOptions, EmbeddingOptions etc HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sdk-for-java.