You can shorten the name of the logger using %logger{x} syntax where x controls shortening procedure. Is there any way to shorten the name of the thread the same way?
Logback Architecture A Logger is a context for log messages. This is the class that applications interact with to create log messages. Appenders place log messages in their final destinations. A Logger can have more than one Appender.
so just write %t on your configuration file in logback. xml reference document : Link and find Outputs the ID of the thread that generated the logging event. [%t] prints thread name not thread id with logback.
GitHub - qos-ch/logback: The reliable, generic, fast and flexible logging framework for Java.
In a Logback. xml file, all the configuration options are enclosed within the <configuration> root element. In the root element, you can set the debug=true attribute to inspect Logback's internal status. You can also configure auto scanning of the configuration file by setting the scan=true attribute.
[%.7thread]
This will print the last 7 characters of the thread name.
Trailing characters of a thread name are often more interesting than the characters at the beginning of a thread name. :-)
You may read about the maximum field width modifier in the logback docs.
You can use:
[%.-10t]
This expression prints the first 10 chars of the thread name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With