[logback-user] Please someone explain %c layout pattern to me

Ceki Gulcu ceki at qos.ch
Fri Feb 27 15:17:05 CET 2009


I also added the following paragraph to the docs:

Please note that the right most segment in a logger name is never
abbreviated, even if its length is longer than the <em>length</em>
option. Other segments may be shortened to at most a single character
but are never removed.


Ceki Gulcu wrote:
> 
> Assume the conversion specifier "%logger{3}" and logger name 
> "mainPackage.sub.sample.Bar". This will result in "m.s.s.Bar" which is 
> the shortest string containing representations for all package names, 
> plus the full name of the rightmost segment (the class name). The 
> package names are represented by a single letter.
> 
> Does that make sense?
> 
> Lukas Zapletal wrote:
>> I cant clearly  understand the documentation of the conversion word %c
>>
>> http://logback.qos.ch/manual/layouts.html
>>
>> I thought %c{10} will always return string at maximum length 10 but
>> its obviously not true. In the JUnit test "hello.world" is abbreviated
>> "h.world" while length set to 1.
>>
>> Seems its a maximum length of the string before the last dot?!?
>>
>> Thanks
>>
>> -----
>> -- 
>> Lukas Zapletal
>> http://lukas.zapletalovi.com
> 

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the Logback-user mailing list