Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

FEJ uses Log4j 2 as a logging framework. Its configuration is stored in the log4j2.xml file. For more information about configuration, please refer to Log4j 2 official documentation.

SecurityPatternLayout is recommended to use with FEJ to hide passwords in the application log file:

Code Block
languagexml
titlelog4j2 xml configuration for password obfuscation
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <SecurityPatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%t] %c{1.} - %msg%n">
                <replace regex = "#554=(.*?)#" replacement="#554=*****#"/>
                <replace regex = "\| 554=(.*?) \|" replacement="\| 554=***** \|"/>
                <replace regex = "<Password>(.*?)</Password>" replacement="<Password>*****</Password>"/>
                <replace regex = "\u0001554=(.*?)\u0001" replacement = "\u0001554=*****\u0001"/>
            </SecurityPatternLayout>
        </Console>
        <File name="fixedgejLog" fileName="./logs/fixedgej.log">
            <SecurityPatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%t] %c{1.} - %msg%n">
                <replace regex = "#554=(.*?)#" replacement="#554=*****#"/>
                <replace regex = "\| 554=(.*?) \|" replacement="\| 554=***** \|"/>
                <replace regex = "<Password>(.*?)</Password>" replacement="<Password>*****</Password>"/>
                <replace regex = "\u0001554=(.*?)\u0001" replacement = "\u0001554=*****\u0001"/>
            </SecurityPatternLayout>
        </File>
        <File name="adminDebugFile" fileName="./logs/fixedgej-admin.log">
            <SecurityPatternLayout pattern="%d{ISO8601} %-5p (%t) [%c{1}(%M:%L)] %m%n">
                <replace regex = "#554=(.*?)#" replacement="#554=*****#"/>
                <replace regex = "\| 554=(.*?) \|" replacement="\| 554=***** \|"/>
                <replace regex = "<Password>(.*?)</Password>" replacement="<Password>*****</Password>"/>
                <replace regex = "\u0001554=(.*?)\u0001" replacement = "\u0001554=*****\u0001"/>
            </SecurityPatternLayout>
        </File>
    </Appenders>
    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="Console"/>
        </Root>

        <Logger name="com.epam.fixengine" level="INFO" additivity="false">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="fixedgejLog"/>
        </Logger>

        <Logger name="com.epam.fej" level="INFO">
            <AppenderRef ref="fixedgejLog"/>
        </Logger>
        <Logger name="org.springframework" level="INFO"/>
        <Logger name="com.epam.fej.cluster.lbc.service" level="INFO"/>
        <Logger name="com.hazelcast" level="warn"/>
        <Logger name="org.crsh" level="warn"/>
        <Logger name="org.apache.kafka" level="info"/>

        <Logger name="com.epam.fej.monitoring" level="INFO" additivity="false">
            <AppenderRef ref="adminDebugFile"/>
        </Logger>
    </Loggers>
</Configuration>