[ 
https://issues.apache.org/jira/browse/LOG4J2-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15887227#comment-15887227
 ] 

Ralph Goers commented on LOG4J2-174:
------------------------------------

Log4j 2.8 now supports omitting the file name on the RollingFileAppender and 
writing directly to the pattern file. In that circumstance the 
RollingFileAppender could support file locking as there would be less 
contention over attempting to rename or possibly even delete the file.  Notice 
that in the documentation you reference it says "with certain limitations". See 
https://logback.qos.ch/manual/appenders.html#prudentWithRolling for those 
restrictions. While Log4j 2 could now support file locking on the 
RollingFileAppender it would be subject to similar restrictions - the filename 
attribute could not be specified, no compression would be allowed, and no other 
asynchronous actions that operate on the file would be allowed during rollover. 

Adding the support with these limitations wouldn't be hard but would require a 
fair amount of testing to make sure that there aren't any other problems that 
happen during rollover.

> Multiple instances of same application server cause 2 problems - want to know 
> if they are solved in log4j 2
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-174
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-174
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>         Environment: Unix based OS and Java based application servers
>            Reporter: Jas Gill
>
> When we start multiple instances of application server using log4j 1.2 and 
> all instances read same configuration file, two problems are noticed. 
> 1. At rollover time first app server doing rollover will do its job properly 
> but when subsequent ones will do rollover again and we lose logs. May be 
> log4j should check that if rolled over file is already present, it should 
> skip rollover.
> 2. After rollover only one instance is logging and others stop logging. The 
> problem is that the active file was rolled over and new file is created. Only 
> one server has pointer to it.
>       <appender name="ROLLING" 
> class="org.apache.log4j.rolling.RollingFileAppender">
>               <param name="Threshold" value="ALL"/>
>               <param name="Append" value="true" />    
>               <rollingPolicy name="CONSOLE" 
> class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
>                       <param name="FileNamePattern" 
> value="${LOG_FILE}.%d{yyyy-MM-dd-HH-mm}" />
>                       <param name="ActiveFileName" value="${LOG_FILE}" />     
>                                 
>               </rollingPolicy>
>               <layout class="org.apache.log4j.PatternLayout">
>                       <param name="ConversionPattern" value="%d{ISO8601} %-5p 
> [%t]%x %c{2} - %m%n"/>
>               </layout>
>       </appender>



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to