How can I Filter Messages in Java, that is controlled by Systemd?
At the moment, I'm writing logs using System.out.println
like this:
System.out.println("Hello this is a Error");
and the Journalctl -b -u test.service gives me this:
Nov 02 11:58:41 test java[10]: Hello this is a Error
I would like to do something like this
Consider a pseudocode:
System.out.println("Hello this is a Error", "Warn");
and obtain the following:
Nov 02 11:58:41 test java[10] [Error]: Hello this is a Error
But I don't want to use Log4j or any other Library. Maybe I just don't know what to search for, can't find a solution. Hope somebody has an idea.