Apurva Sinha created LOG4J2-1654:
------------------------------------

             Summary: log4j2 printing incomplete records on file rotation
                 Key: LOG4J2-1654
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1654
             Project: Log4j 2
          Issue Type: Question
            Reporter: Apurva Sinha


I have a log4j2 file which I am using for printing records to a CSV file. In 
some scenarios, the records are not completely printed therefore making the CSV 
file as non-parseable. Following is the example of an incomplete record printed 
in the file .

Time,User Id,Activity Id,Status,Source,Correlation Id,Business Data,Activity 
Type

26-Oct-2016 
10:57:12,t,ENTITYSELECTED,SUCCESS,COM.CLEARTRAIL.CLEARINSIGHT.SERVICE.UISERVICE,,"{""cacheviewname"":null,""entitySelectedID"":""283c5e8e-f8c4-45d4-b8be-925e2a280267"",""selectedKeys"":""[{\""extension\"":\""8626\"",\""ci_primarykey\"":\""9\""},{\""extension\"":\""4121\"",\""ci_primarykey\"":\""9\""},{\""extension\"":\""4167\"",\""ci_primarykey\"":\""9\""}]"",""scopeIds"":""[\""1c7a221e-51aa-4d73-b0b7-e98dccd477ad\"",\""45d187fd-6f3c-4dc5-89b6-ac8f5cd87444\""]"",""sourceViewId"":""f875b24b-90de-4adc-8
where incomplete json is printed on file rotation . this rotation is given 
based on size . Following is the configuration for this output:

   <RollingRandomAccessFile name="auditfileAppender" bufferSize = "1024" 
fileName="${audit-file-path}/${audit-file-name}.tmp" append="true" 
filePattern="${audit-file-path}/${audit-file-name}-%d{yyyy-MM-dd}-%i.csv" 
immediateFlush="false">
      <PatternLayout header="${csvauditheader:key1}${sys:line.separator}" 
pattern="%.10000m %n"/>
      <Policies>
          <SizeBasedTriggeringPolicy size="1 MB" />
      </Policies>
      <DefaultRolloverStrategy>
          <Delete basePath="${baseDir}" maxDepth="1">
              <IfFileName glob="${audit-file-name}*.csv"/>
              <IfAny>
                  <IfLastModified age="15d" />
                  <IfAccumulatedFileSize exceeds="1 GB" />
              </IfAny>
          </Delete>
      </DefaultRolloverStrategy>
  </RollingRandomAccessFile>
Request for any help on this issue if there are any configuration issues .I am 
currently working on version 2.6.2. Should I use the updated version for this 
issue , if any fix is available in the new version .



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