Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dernasherbrezon/journald-formatter
JUL Formatter which sends logs to journald with proper log level
https://github.com/dernasherbrezon/journald-formatter
java journald logging maven
Last synced: 24 days ago
JSON representation
JUL Formatter which sends logs to journald with proper log level
- Host: GitHub
- URL: https://github.com/dernasherbrezon/journald-formatter
- Owner: dernasherbrezon
- License: apache-2.0
- Created: 2019-09-03T18:46:13.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-21T20:02:08.000Z (over 3 years ago)
- Last Synced: 2024-10-01T16:09:42.937Z (about 1 month ago)
- Topics: java, journald, logging, maven
- Language: Java
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About [![Build Status](https://travis-ci.com/dernasherbrezon/journald-formatter.svg?branch=master)](https://travis-ci.com/dernasherbrezon/journald-formatter) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ru.r2cloud%3Ajournald-formatter&metric=alert_status)](https://sonarcloud.io/dashboard?id=ru.r2cloud%3Ajournald-formatter)
This project provides special JUL formatter. It will format log levels as numbers instead of strings. These numbers are from syslog format. Using these numbers could help you assign proper log level in journald. See the example below.
## Example configuration
Here is example configuration:
```
java.util.logging.ConsoleHandler.formatter=ru.r2cloud.logging.JournaldFormatter
java.util.logging.JournaldFormatter.format=<%4$s>%5$s%6$s [%2$s]%n
```It looks like a normal SimpleFormatter configuration. The trick is in ```<%4$s>```. When java process outputs log entries with such prefix, journald can parse them and assign proper level. Later on, these log entries could be searched, parsed, analyzed via journalctl:
```
journalctl -u myservice -p err -n 20
```