Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaabramov/glogging
Logback layout for Google Structured logging
https://github.com/aaabramov/glogging
Last synced: 13 days ago
JSON representation
Logback layout for Google Structured logging
- Host: GitHub
- URL: https://github.com/aaabramov/glogging
- Owner: aaabramov
- License: apache-2.0
- Created: 2021-08-22T12:15:53.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-22T11:04:18.000Z (over 1 year ago)
- Last Synced: 2023-07-28T10:08:19.910Z (over 1 year ago)
- Language: Java
- Size: 51.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Logback layout for Google Structured logging
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.aaabramov/glogging/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.aaabramov/glogging) ![Build](https://github.com/aaabramov/glogging/actions/workflows/maven.yml/badge.svg)
---
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua)
---
## Why?
- Google indexes logs - easies and faster to filter logs.
See [Using the Logs Explorer](https://cloud.google.com/logging/docs/view/logs-viewer-interface)
- Aggregating logs by labels
- Log metrics
- Proper logging levels in the UI
- See [this StackOverflow](https://stackoverflow.com/q/44164730/5091346) questionSee [structured logs](https://cloud.google.com/logging/docs/structured-logging).
## Getting started
Maven:
```xml
io.github.aaabramov
glogging-core
0.1.0
io.github.aaabramov
glogging-gson
0.1.0
```
Gradle (Groovy):
```groovy
implementation 'io.github.aaabramov:glogging-core:0.1.0'
implementation 'io.github.aaabramov:glogging-gson:0.1.0'
// OR
// implementation 'io.github.aaabramov:glogging-jackson:0.1.0'
```Gradle (Kotlin):
```kotlin
implementation("io.github.aaabramov:glogging-core:0.1.0")
implementation("io.github.aaabramov:glogging-gson:0.1.0")
// OR
// implementation("io.github.aaabramov:glogging-jackson:0.1.0")
```Sbt:
```sbt
libraryDependencies ++= Seq(
"io.github.aaabramov" % "glogging-core",
"io.github.aaabramov" % "glogging-gson"
// OR
// "io.github.aaabramov" % "glogging-jackson"
).map(_ % "0.1.0")
```## Configuration example:
```xml
io.github.aaabramov.glogging.JacksonEncoder
true
com.yourcompany
%message %xException{10}
```
## Example output:
```
{"timestamp":{"seconds":1629642099,"nanos":659000000},"severity":"DEBUG","message":"debug","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
{"timestamp":{"seconds":1629642099,"nanos":659000000},"severity":"INFO","message":"info","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
{"timestamp":{"seconds":1629642099,"nanos":659000000},"severity":"WARN","message":"warn","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
{"timestamp":{"seconds":1629642099,"nanos":661000000},"severity":"ERROR","message":"error java.lang.RuntimeException: BOOM\n\tat io.github.aaabramov.glogging.App.main(App.java:22)","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
{"timestamp":{"seconds":1629642102,"nanos":661000000},"severity":"DEBUG","message":"debug","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
{"timestamp":{"seconds":1629642102,"nanos":661000000},"severity":"INFO","message":"info","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
{"timestamp":{"seconds":1629642102,"nanos":661000000},"severity":"WARN","message":"warn","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
{"timestamp":{"seconds":1629642102,"nanos":661000000},"severity":"ERROR","message":"error","labels":{"io.github.aaabramov/name":"Andrii","io.github.aaabramov/loggerName":"io.github.aaabramov.glogging.App"}}
```## Releasing
```bash
mvn versions:set -DnewVersion=X.Y.Z
mvn versions:commit
mvn clean javadoc:jar source:jar verify gpg:sign deploy
# Close & Release here https://s01.oss.sonatype.org/#stagingRepositories
```