Digital Marketing

Sample Log4j2 XML configuration for rolling file and console

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
        <Root level="TRACE">
            <AppenderRef ref="RollingFileAppender" level="INFO" />
            <appender-ref ref="Console" level="TRACE" />
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t]
      %highlight{%level}{FATAL=bg_red, ERROR=red, WARN=yellow, INFO=green, DEBUG=blue} - %msg%n" />
        <RollingFile name="RollingFileAppender" fileName="logs/" filePattern="logs/$${date:yyyy-MM}/email-%d{MM-dd-yyyy}">
                <Pattern>%d [%t] %p %c - %m%n</Pattern>
                <OnStartupTriggeringPolicy />
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="48 MB" />
            <DefaultRolloverStrategy max="8" />


Popular posts from this blog

Fixed WSL sshd: no hostkeys available -- exiting

PowerMTA pmta command

How to fix: mv: failed to preserve ownership