Class ScriptPatternSelector
- java.lang.Object
-
- org.apache.logging.log4j.core.layout.ScriptPatternSelector
-
- All Implemented Interfaces:
LocationAware,PatternSelector
@Plugin(name="ScriptPatternSelector", category="Core", elementType="patternSelector", printObject=true) public class ScriptPatternSelector extends Object implements PatternSelector, LocationAware
Selects the pattern to use based on the result of executing a Script. The returned value will be used as the "key" to choose between one of the configured patterns. If no key is returned or there is no match the default pattern will be used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScriptPatternSelector.BuilderCustom ScriptPatternSelector builder.
-
Field Summary
-
Fields inherited from interface org.apache.logging.log4j.core.layout.PatternSelector
ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description ScriptPatternSelector(AbstractScript script, PatternMatch[] properties, String defaultPattern, boolean alwaysWriteExceptions, boolean disableAnsi, boolean noConsoleNoAnsi, Configuration config)Deprecated.UsenewBuilder()instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ScriptPatternSelectorcreateSelector(AbstractScript script, PatternMatch[] properties, String defaultPattern, boolean alwaysWriteExceptions, boolean noConsoleNoAnsi, Configuration configuration)Deprecated.UsenewBuilder()instead.PatternFormatter[]getFormatters(LogEvent event)static ScriptPatternSelector.BuildernewBuilder()Creates a builder for a custom ScriptPatternSelector.booleanrequiresLocation()StringtoString()
-
-
-
Constructor Detail
-
ScriptPatternSelector
@Deprecated public ScriptPatternSelector(AbstractScript script, PatternMatch[] properties, String defaultPattern, boolean alwaysWriteExceptions, boolean disableAnsi, boolean noConsoleNoAnsi, Configuration config)
Deprecated.UsenewBuilder()instead. This will be private in a future version.
-
-
Method Detail
-
requiresLocation
public boolean requiresLocation()
- Specified by:
requiresLocationin interfaceLocationAware
-
getFormatters
public PatternFormatter[] getFormatters(LogEvent event)
- Specified by:
getFormattersin interfacePatternSelector
-
newBuilder
@PluginBuilderFactory public static ScriptPatternSelector.Builder newBuilder()
Creates a builder for a custom ScriptPatternSelector.- Returns:
- a ScriptPatternSelector builder.
-
createSelector
@Deprecated public static ScriptPatternSelector createSelector(AbstractScript script, PatternMatch[] properties, String defaultPattern, boolean alwaysWriteExceptions, boolean noConsoleNoAnsi, Configuration configuration)
Deprecated.UsenewBuilder()instead.Deprecated, usenewBuilder()instead.- Parameters:
script-properties-defaultPattern-alwaysWriteExceptions-noConsoleNoAnsi-configuration-- Returns:
- a new ScriptPatternSelector
-
-