Using custom layout and filter
Using the log4j1 utility, you can modify the log message.
Modify the log message in the following places:
- Layout - Forms the actual message
- Appender - Writes the message
Sterling™ Order Management System Software provides a custom layout, SCIFilteredPatternLayout, to handle message modification. The custom Layout first delegate to a normal PatternLayout (org.apache.log4j.PatternLayout.class) to get a formatted message. When the formatted message is received, the custom Layout will filter the results based on a set of configurable regular expressions, before finally returning the fixed string. (Optional) A replace string can also be provided for every regular expression pattern and in case it is not set then the matched text is replaced by the default replacement string.
You must change the layout class name in your custom logging configuration to SCIFilteredPatternLayout, for example:
<layout class="com.sterlingcommerce.woodstock.util.frame.logex.SCIFilteredPatternLayout">
<param name="ConversionPattern" value="%d:%-7p:%t: %-60m[%X{AppUserId}]: %-25c{1}%n"/>
<param name="FilterSet" value="<layout_filterSet_name>"/> <!-- Optional -->
</layout>
Sterling Order Management System Software provides a custom filter, SCIPatternFilter, to filter out any messages that match certain regular expressions. The custom Filter enables you to match a message against a set of regular expressions and mask if it matches.
You must change the filter class name in your custom logging configuration, for example:
<filter class=”com.sterlingcommerce.woodstock.util.frame.logex.SCIPatternFilter” >
<param name=”FilterSet” value=”suppress” /> <!-- Optional -->
</filter>
The following example calls an API with the following element in the input XML:
<Payment PaymentType=”CREDIT_CARD” CreditCardNo=”411kdiwbc6fj1111”
SecureAuthenticationCode=”1234” MaxChargeLimit=”100.00”/>
If the log level is set to VERBOSE, then the XML element will be logged as it appears above. Using the Log Filter, the following would be entered instead in the log file:
<Payment PaymentType=”CREDIT_CARD” CreditCardNo=”411kdiwbc6fj1111”
SecureAuthenticationCode=”***” MaxChargeLimit=”100.00”/>