<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">Yes, I did notice all that you mentioned, but I still could not find any way to print the class name ONLY without the package name.<br>Thanks. (I want to see only "Bar" not m.s.s., etc.) I would think this would be a feature that would be worthwhile to have as part of logback.<br>I guess I'll have to implement it myself then.<br>thank you!<br><br>Arthur<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Ceki Gulcu <listid@qos.ch><br>To: logback users list <logback-user@qos.ch><br>Sent: Thursday, July 12, 2007 3:02:47 PM<br>Subject: Re: [logback-user] PatternLayout feature request<br><br><div><br>Hi Arthur,<br><br>Logback already offers a similar feature called
automatic abbreviation<br>for logger names and for class names.<br><br>For example, the pattern "%logger{10}" will attempt to abbreviate the<br>logger name to 10 characters, thus the logger name<br>"mainPackage.sub.sample.Bar" will be printed as "m.s.s.Bar". The table<br>below from the Layout chapter [1] of the log4j manual lists other<br>examples.<br><br>Pattern Logger name Result<br>%logger mainPackage.sub.sample.Bar mainPackage.sub.sample.Bar<br>%logger{10} mainPackage.sub.sample.Bar m.s.s.Bar<br>%logger{15} mainPackage.sub.sample.Bar m.s.sample.Bar<br>%logger{16} mainPackage.sub.sample.Bar
m.sub.sample.Bar<br>%logger{26} mainPackage.sub.sample.Bar mainPackage.sub.sample.Bar<br><br><br>Alternatively, logback makes it very easy (even easier than in log4j)<br>to define your own conversion patterns. See the section called<br>"Creating a custom conversion specifier" in the Layout chapter of the<br>logback manual.<br><br>I hope this helps,<br><br>[1] <a target="_blank" href="http://logback.qos.ch/manual/layouts.html">http://logback.qos.ch/manual/layouts.html</a><br><br>Arthur Blake wrote:<br>> I'm using Logback on a new project. I like it a lot so far. Seems like <br>> a leaner, tighter log4j. Pretty easy to learn quickly because it is so <br>> similar to log4j in a lot of ways.<br>> <br>> I'd like to see a feature in the PatternLayout where I can show just the <br>> class name of the logger without its package prefix.<br>> For example, if
I have a logger named <br>> com.mycompany.myapplication.myarea.Stuff<br>> I'd like a version of the %logger conversion word that just outputs "Stuff"<br>> (not "com.mycompany.myapplication.myarea.Stuff" or even "c.m.m.m.Stuff")<br>> <br>> Most of my classes are unique across package names, and I'd like my log <br>> output to be more concise in this way.<br>> I'm not worried about being confused by name collisions because my <br>> application is small enough that it's obvious what logger is involved in <br>> my log output.<br>> <br>> I've gotten around this so far by naming some of my logs with just the <br>> class name without it's package, but I'd rather have a PatternLayout <br>> conversion word or specifier to handle this.<br>> <br>> Forgive me if this feature is already in the PatternLayout, but I <br>> couldn't find it after looking pretty hard.<br>> <br>> Arthur<br><br>-- <br>Ceki Gülcü<br>Logback: The reliable,
generic, fast and flexible logging framework for Java.<br><a target="_blank" href="http://logback.qos.ch">http://logback.qos.ch</a><br>_______________________________________________<br>Logback-user mailing list<br>Logback-user@qos.ch<br><a target="_blank" href="http://qos.ch/mailman/listinfo/logback-user">http://qos.ch/mailman/listinfo/logback-user</a><br></div></div><br></div></div><br>
<hr size=1>Now that's room service! <a href="http://travel.yahoo.com/hotelsearchpage;_ylc=X3oDMTFtaTIzNXVjBF9TAzk3NDA3NTg5BF9zAzI3MTk0ODEEcG9zAzIEc2VjA21haWx0YWdsaW5lBHNsawNxMS0wNw--
">Choose from over 150,000 hotels <br>in 45,000 destinations on Yahoo! Travel</a> to find your fit.</body></html>