Please someone explain %c layout pattern to me

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 -- View this message in context: http://www.nabble.com/Please-someone-explain--c-layout-pattern-to-me-tp22246... Sent from the Logback User mailing list archive at Nabble.com.

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

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

Ceki Gulcu napsal(a):
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.
Its clear now, thanks. LZ
participants (3)
-
Ceki Gulcu
-
Lukas Zapletal
-
Lukas Zapletal