I know how to print the class name and method name with log4j, both fields can be aligned and padded separately, for example. this template:
[%d{ISO8601}] %-5p %-10C{1}:%-10M %m%n
creates something like:
[2012-09-20 08:25:12,111] WARN Class :method Logtext1 which should align [2012-09-20 08:25:12,111] WARN ClassTwo :methodName Logtext2 which should align
This will align the registered text (in most cases), but the class name and method name will be ugly.
So I would like to output something like:
[2012-09-20 08:25:12,111] WARN Class:method Logtext1 which should align [2012-09-20 08:25:12,111] WARN ClassTwo:methodName Logtext2 which should align
Can only configuration be used?
Can you suggest another way to output the method name and class name while keeping the log text aligned?
source share