SIBISH BASHEER created LOG4J2-672:
-------------------------------------

             Summary: AsyncLogger logs missing
                 Key: LOG4J2-672
                 URL: https://issues.apache.org/jira/browse/LOG4J2-672
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.0-rc1
         Environment: Windows 7
            Reporter: SIBISH BASHEER


Below is my configuration. Whenever I run the code, many error logs are missing 
at the end. Is this a problem with the Asynclogger? I am using 2.0-rc1.

<Configuration>
<Appenders>
<RollingFile name="APP.ALERT" 
  fileName="C:\Users\sbasheer\Downloads\splunklogs\Alert.log" 
  filePattern="C:\Users\abc\Downloads\abclogs\Alert%d{MM-dd-yyyy}-%i.log">
  <PatternLayout>
    <Pattern>%d | %5p %t %n %X{eventUUID} %c:%M(%L) : %m %n</Pattern>
  </PatternLayout>
  <Policies>
    <TimeBasedTriggeringPolicy />
    <SizeBasedTriggeringPolicy size="25 MB"/>
  </Policies>
  <DefaultRolloverStrategy max="50"/>
</RollingFile>
<Console name="STDOUT" target="SYSTEM_OUT">
  <PatternLayout pattern="%d %-5p [%t] %c{2} - %m%n" />
</Console>
</Appenders>
<Loggers>
<AsyncLogger name="com.abc.asyncsample"  level="trace" includeLocation="true"> 
  <AppenderRef ref="APP.ALERT" level="error"/>
</AsyncLogger>
<Root level="info" includeLocation="true">
  <AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
Code:

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;



public class AppAsyncMain {
        
          private static Logger logger = 
LogManager.getLogger("com.americanexpress.splunk.asyncsample");

        public static void main(String[] args) {
  
                
                logger.error("Entering application.");
                for(int i=0;i<100000;i++)
                {
                logger.info("Info::" + i);
        //      logger.debug("Debug::" + i);
                logger.error("Error::" + i);
        //      logger.warn("Warn::" + i);
                }
                logger.error("Exiting application.");

        }

}

Issue is intermittent. Some logs at the end are missing.  Like the below log is 
generated:
2014-06-16 16:36:29,830 | ERROR main 
  com.americanexpress.splunk.asyncsample:main(30) : Error::99834 

Instead of:
2014-06-16 16:59:00,634 | ERROR main 
  com.americanexpress.splunk.asyncsample:main(30) : Error::99999 
2014-06-16 16:59:00,634 | ERROR main 
  com.americanexpress.splunk.asyncsample:main(33) : Exiting application. 


In Console, logs are displayed correctly. In the file, logs are missing.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
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