Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2014

How to configure a Failover appender for a RollingFile Appender which is inside a RoutingAppender?

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.8.2
    • Fix Version/s: 2.8.2
    • Component/s: Appenders
    • Labels:
      None
    • Environment:

      Operating System : Centos7
      Tomcat Version : 7.5

      Description

      I am using RoutingAppender to create log files dynamically, hence inside the RollingFile Appenders are nested inside the RoutingAppenders. Now I need to configure a FailoverAppender for the nested RoutingAppender.
      This is what configuration looks like:

      <Routing name="AuditLogRouting">
        <Routes pattern="$${ctx:ROUTINGKEY}">
          <Route>
            <Failover name="AUDIT_LOG_FAILOVER" primary="Rolling-${ctx:ROUTINGKEY}">
              <Failovers>
                <AppenderRef ref="DRFILE" />
      	</Failovers>
           </Failover>
      		    <RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="${sys:catalina.base}/logs/${ctx:ROUTINGKEY}.log"
      						filePattern="${sys:catalina.base}/logs/${ctx:ROUTINGKEY}-%d{yyyyMMdd}.log.gz"
      						immediateFlush="true">
                         <PatternLayout>
      			<pattern>%m%n</pattern>
      			  </PatternLayout>
      			    <Policies>
      				<TimeBasedTriggeringPolicy interval="1" modulate="true" />
      			    </Policies>
      			</RollingFile>
      		</Route>
      	</Routes>
      </Routing>
      

      If I try to put the FailoverAppender inside the RoutingAppender, I get an error that the FailoverAppender is not initialized. I need to know how do I configure the Failover appender for the RollingFileAppender nested inside the RoutingAppender.

      Thanks!

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              khobragade.d Deepak Khobragade
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: