logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: Log4j 2 Conversion Pattern + negative precision
Date Mon, 04 Jan 2016 23:45:34 GMT
In Log4j2, you can use %c{2} to _include_ the rightmost 2 packages. See the
docs you point to...

Gary

On Thu, Dec 3, 2015 at 4:11 AM, Schudt, Christian <Christian.Schudt@cgm.com>
wrote:

> Hello,
>
> log4j 1 has the possibiliy to specify a negative precision for the logger
> name in the pattern, e.g.:
>
> c{-4}
>
> which meant, that the 4 left most package names were excluded.
>
> E.g. "org.apache.logging.log4j.core.LogEvent" becomes "core.LogEvent"
>
> In Log4j2, this pattern results in:
>
> "-.-.-.-.core.LogEvent"
>
> How can I achieve the log4j 1 behavior, i.e. excluded the first X package
> names?
>
> Thanks,
> Christian
>
> Related documentation:
> http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message