You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2013/09/01 08:12:52 UTC

[jira] [Resolved] (LOG4J2-315) Multiple threads logging to same AsyncAppender- Data Loss

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

Remko Popma resolved LOG4J2-315.
--------------------------------

    Resolution: Not A Problem

I finally found the answer to why this is happening: it's the spec.
By default the DefaultRolloverStrategy only keeps up to 7 files for the same date pattern... http://logging.apache.org/log4j/2.x/manual/appenders.html#DefaultRolloverStrategy
(Perhaps this should be stated more prominently in the documentation.)

If you add this line to your configuration you can increase the number of rolled-over files that can co-exist:

{{<DefaultRolloverStrategy max="20"/>}}

Example configuration snippet:
{code}
<RollingFile name="SUMMARY_ALL" fileName="./logs/summary.log"
  filePattern="logs/$${date:yyyy-MM}/summary-%d{yyyy-MM-dd-HH-mm}-%i.log">
  <PatternLayout>
    <pattern>%d{ISO8601} [%t] %p %c - %m%n</pattern>
  </PatternLayout>
  <Policies>
    <TimeBasedTriggeringPolicy interval="6"
      modulate="true" />
    <SizeBasedTriggeringPolicy size="40MB" />
  </Policies>
  <DefaultRolloverStrategy max="20"/> <!-- Necessary when generating more than 7 * 40 MB -->
</RollingFile>
{code}

I'm resolving this issue as Not A Problem.
Please verify and close.
                
> Multiple threads logging to same AsyncAppender- Data Loss
> ---------------------------------------------------------
>
>                 Key: LOG4J2-315
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-315
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>            Reporter: Sudharma Puranik
>            Assignee: Remko Popma
>            Priority: Blocker
>         Attachments: log4j2.xml, ResultStats.java, TestMultiThread.zip
>
>
> creating multiple threads which logs messages. I could see that for 5 million logging messages only 4.7 million messages  are logged. Dont know what is the reason but this could be something serious for auditing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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