I'm sorry, I was slightly wrong. You can indeed do exactly what you're looking for with PatternLayout. See < http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout> for docs. You'll want to use the RegexReplacement configuration. For an example config, check out < https://github.com/apache/logging-log4j2/blob/trunk/log4j-core/src/test/resources/log4j-replace.xml>. It's pretty simple, no Java code required!
On 1 March 2014 12:48, Matt Sicker <[email protected]> wrote: > The regex filter would filter which messages get logged to the configured > logger based on regex pattern matching. What you'd want is a Layout > (probably a PatternLayout) to specify what fields to log. If that doesn't > solve the problem, a custom Layout class would probably solve the issue. > > > On 28 February 2014 18:04, James Hart <[email protected]> wrote: > >> Hi >> >> I'm an admin for a java application that uses log4j. >> >> I'm working with a vendor to see if there's a way to scrub the output of >> their log messages. The output of these messages is quite long (at least a >> few hundred characters) making the lines difficult to read when >> troubleshooting. >> >> Is there a way to apply a standard log4j filter or layout that will takes >> a >> regex as input and generate a reduced line with only the bits of text we >> care to see? >> >> I thought maybe this RegexFilter would do the trick, but I can't quite >> tell >> by the documentation: >> >> http://logging.apache.org/log4j/2.x/manual/filters.html >> >> Any and all help is much appreciated. >> >> Thank you. >> > > > > -- > Matt Sicker <[email protected]> > -- Matt Sicker <[email protected]>
