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: about 2 months 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 (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-02T10:35:55.000Z (over 1 year ago)
- Last Synced: 2026-02-23T02:00:29.848Z (4 months ago)
- Topics: java, journald, logging, maven
- Language: Java
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About [](https://github.com/dernasherbrezon/journald-formatter/actions/workflows/build.yml) [](https://sonarcloud.io/summary/new_code?id=dernasherbrezon_journald-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 [%2$s]%6$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
```