
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. 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. I guess I'll have to implement it myself then. thank you! Arthur ----- Original Message ---- From: Ceki Gulcu <listid@qos.ch> To: logback users list <logback-user@qos.ch> Sent: Thursday, July 12, 2007 3:02:47 PM Subject: Re: [logback-user] PatternLayout feature request Hi Arthur, Logback already offers a similar feature called automatic abbreviation for logger names and for class names. For example, the pattern "%logger{10}" will attempt to abbreviate the logger name to 10 characters, thus the logger name "mainPackage.sub.sample.Bar" will be printed as "m.s.s.Bar". The table below from the Layout chapter [1] of the log4j manual lists other examples. Pattern Logger name Result %logger mainPackage.sub.sample.Bar mainPackage.sub.sample.Bar %logger{10} mainPackage.sub.sample.Bar m.s.s.Bar %logger{15} mainPackage.sub.sample.Bar m.s.sample.Bar %logger{16} mainPackage.sub.sample.Bar m.sub.sample.Bar %logger{26} mainPackage.sub.sample.Bar mainPackage.sub.sample.Bar Alternatively, logback makes it very easy (even easier than in log4j) to define your own conversion patterns. See the section called "Creating a custom conversion specifier" in the Layout chapter of the logback manual. I hope this helps, [1] http://logback.qos.ch/manual/layouts.html Arthur Blake wrote:
I'm using Logback on a new project. I like it a lot so far. Seems like a leaner, tighter log4j. Pretty easy to learn quickly because it is so similar to log4j in a lot of ways.
I'd like to see a feature in the PatternLayout where I can show just the class name of the logger without its package prefix. For example, if I have a logger named com.mycompany.myapplication.myarea.Stuff I'd like a version of the %logger conversion word that just outputs "Stuff" (not "com.mycompany.myapplication.myarea.Stuff" or even "c.m.m.m.Stuff")
Most of my classes are unique across package names, and I'd like my log output to be more concise in this way. I'm not worried about being confused by name collisions because my application is small enough that it's obvious what logger is involved in my log output.
I've gotten around this so far by naming some of my logs with just the class name without it's package, but I'd rather have a PatternLayout conversion word or specifier to handle this.
Forgive me if this feature is already in the PatternLayout, but I couldn't find it after looking pretty hard.
Arthur
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user ____________________________________________________________________________________ The fish are biting. Get more visitors on your site using Yahoo! Search Marketing. http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php