[ 
https://issues.apache.org/jira/browse/LOG4J2-1134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory updated LOG4J2-1134:
---------------------------------
    Fix Version/s:     (was: 2.4.1)

> Possible to create Failover appender on first occurence
> -------------------------------------------------------
>
>                 Key: LOG4J2-1134
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1134
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>    Affects Versions: 2.4
>            Reporter: Hüseyin Kartal
>            Priority: Minor
>
> Hi,
> we use primary the SocketAppender to send log messages to a server instance. 
> For failover purpose we defined a FailoverAppender with a 
> RollingRandomAccessFileAppender as the failover instance.
> Following the configuration:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration monitorInterval="0" strict="true" name="XMLConfig" 
> status="fatal" shutdownHook="enable" 
> xmlns="http://jakarta.apache.org/log4j2/config"; 
> xmlns:events="http://jakarta.apache.org/log4j2/events"; 
> xmlns:levels="http://jakarta.apache.org/log4j2/levels"; 
> xmlns:xi="http://www.w3.org/2001/XInclude"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:schemaLocation="http://jakarta.apache.org/log4j2/config Log4j-config.xsd 
> http://jakarta.apache.org/log4j2/events Log4j-events.xsd 
> http://jakarta.apache.org/log4j2/levels Log4j-levels.xsd">
>       <xi:include href="log4j2-properties.xml" />
>       <Appenders>
>               <Appender type="Socket" name="OUT-SOCKET" 
> host="${sys:log.host}" port="${sys:log.port}" protocol="${sys:log.protocol}" 
> ignoreExceptions="false">
>                       <Layout type="JsonLayout" compact="true" 
> eventEol="true" complete="true" properties="true" />
>               </Appender>
>               <Appender type="Failover" name="OUT-FAIL" primary="OUT-SOCKET">
>                       <Failovers>
>                               <Appender type="RollingRandomAccessFile" 
> name="OUT-FILE" fileName="${file.name.tmp}${file.suffix}" 
> filePattern="${file.name.tmp}-%2i${file.suffix}" ignoreExceptions="false">
>                                       <Layout Type="PatternLayout" 
> Pattern="${pattern.single}" />
>                                       <Policies>
>                                               <SizeBasedTriggeringPolicy 
> size="${sizeBasedTriggeringPolicy.size}" />
>                                       </Policies>
>                                       <DefaultRolloverStrategy 
> max="${defaultRolloverStrategy.max}" fileIndex="min" />
>                               </Appender>
>                       </Failovers>
>               </Appender>
>               <Async name="ASYNC-OUT-FAIL">
>                       <AppenderRef ref="OUT-FAIL" />
>               </Async>
>       </Appenders>
>       <Loggers>
>               <asyncRoot level="all">
>                       <AppenderRef ref="ASYNC-OUT-FAIL" />
>               </asyncRoot>
>               <asyncLogger name="com" level="error" />
>               <asyncLogger name="org" level="error" />
>               <asyncLogger name="javax" level="error" />
>       </Loggers>
> </Configuration>
> {code}
> Question: The appender OUT-FILE with the corresponding file is created on 
> startup. Is it possible to create this file or the Appender only if a 
> failover issue occurs?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to