estk / log4rs

A highly configurable logging framework for Rust
Apache License 2.0
973 stars 143 forks source link

Changed the order of the field in json log output #333

Closed freakmaxi closed 7 months ago

freakmaxi commented 7 months ago

I've changed the order of the fields for JSON output for better observability when logs are dumped in a file and require eye inspection.

I believe the following order

time - level - message - (rest of the log fields)...

for the logs output would be better to catch the desired logs...

bconn98 commented 7 months ago

Hmm, this aligns better with what I've seen in the past but I'm not sure how I feel about it. IMO JSON logging is mostly for being parsed by tools such as ELK stack and not by users eyes.

freakmaxi commented 7 months ago

Hmm, this aligns better with what I've seen in the past but I'm not sure how I feel about it. IMO JSON logging is mostly for being parsed by tools such as ELK stack and not by users eyes.

To be honest, we are using it in multiple ways. One is checking the log outputs on the pod console in Kubernetes, which is the first and quick eye inspection and which is hard to capture which output is about what, and those logs are collected by fluent and pushed to elastic. We can query using Kibana (no problem here). However, also we have an exporter, which collects console logs and pushes them to an S3 bucket to analyze them for both user inspection and automated analysis. User inspection part is a bit painful because of the field order.

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (97c1347) 61.23% compared to head (ee30d2b) 61.12%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #333 +/- ## ========================================== - Coverage 61.23% 61.12% -0.12% ========================================== Files 23 23 Lines 1406 1407 +1 ========================================== - Hits 861 860 -1 - Misses 545 547 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.