简体   繁体   中英

Log4j define length for combined pattern

Is it possible to define an overall length for in the layout pattern for the combination of two or more conversion characters?

Right now I use

<PatternLayout>
    <pattern>[%-5level] | {%c{1}::%M (line %4L)} | %msg%n</pattern>
</PatternLayout>

But I want to define the overall length (width) of the complete expression

 {%c{1}::%M (line %4L)}

How can this be achieved?

That is impossible with patterns according to PatternLayout manual

You can test patterns here: online tester

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM