org.apache.logging.log4j.core.pattern
Class RegexReplacement

java.lang.Object
  extended by org.apache.logging.log4j.core.pattern.RegexReplacement

@Plugin(name="replace",
        category="Core",
        printObject=true)
public final class RegexReplacement
extends Object

Replace tokens in the LogEvent message.


Method Summary
static RegexReplacement createRegexReplacement(Pattern regex, String replacement)
          Create a RegexReplacement.
 String format(String msg)
          Perform the replacement.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

format

public String format(String msg)
Perform the replacement.

Parameters:
msg - The String to match against.
Returns:
the replacement String.

toString

public String toString()
Overrides:
toString in class Object

createRegexReplacement

@PluginFactory
public static RegexReplacement createRegexReplacement(@PluginAttribute(value="regex")
                                                                    Pattern regex,
                                                                    @PluginAttribute(value="replacement")
                                                                    String replacement)
Create a RegexReplacement.

Parameters:
regex - The regular expression to locate.
replacement - The replacement value.
Returns:
A RegexReplacement.


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.