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

Gary Gregory updated LOG4J2-1482:
---------------------------------
    Description: 
The header and first record are coming in first line in case of 
CsvParameterLayout. This messes up the header for the first file as well as for 
the subsequent files. And if we use line separator as part of header, the first 
file seems ok but the first record in subsequent files comes out to be empty 
with only commas.

Copied from the SO post:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="MyApp" packages="">
    <Properties>
        <Property name="audit-path">D:/watcher</Property>
        <Property name="file-name">audit</Property>
        <Property name="file-header">param1,param2,param3</Property>
    </Properties>

    <Appenders>
    <RollingFile name="auditfile"
        fileName="${audit-path}/${file-name}.tmp" 
filePattern="${audit-path}/${file-name}-%d{yyyy-MM-dd}-%i.csv">
        <CsvParameterLayout delimiter="," header="${file-header}">
        </CsvParameterLayout>
        <Policies>
            <SizeBasedTriggeringPolicy size="80 B" />
        </Policies>
        <DefaultRolloverStrategy max="2"/>
    </RollingFile>
</Appenders>

<Loggers>
    <Root level="info">
        <AppenderRef ref="auditfile" />
    </Root>
</Loggers>
{code}

  was:
The header and first record are coming in first line in case of 
CsvParameterLayout. This messes up the header for the first file as well as for 
the subsequent files. And if we use line separator as part of header, the first 
file seems ok but the first record in subsequent files comes out to be empty 
with only commas.

[Copied from the SO post:]
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="MyApp" packages="">
    <Properties>
        <Property name="audit-path">D:/watcher</Property>
        <Property name="file-name">audit</Property>
        <Property name="file-header">param1,param2,param3</Property>
    </Properties>

    <Appenders>
    <RollingFile name="auditfile"
        fileName="${audit-path}/${file-name}.tmp" 
filePattern="${audit-path}/${file-name}-%d{yyyy-MM-dd}-%i.csv">
        <CsvParameterLayout delimiter="," header="${file-header}">
        </CsvParameterLayout>
        <Policies>
            <SizeBasedTriggeringPolicy size="80 B" />
        </Policies>
        <DefaultRolloverStrategy max="2"/>
    </RollingFile>
</Appenders>

<Loggers>
    <Root level="info">
        <AppenderRef ref="auditfile" />
    </Root>
</Loggers>
{code}


> Improper header in CsvParameterLayout
> -------------------------------------
>
>                 Key: LOG4J2-1482
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1482
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.6.2
>            Reporter: Sumit Singhal
>         Attachments: csv-with-line-seprator-1.csv, 
> csv-with-line-seprator-2.csv, csv-without-line-separator-1.csv, 
> csv-without-line-separator-2.csv
>
>
> The header and first record are coming in first line in case of 
> CsvParameterLayout. This messes up the header for the first file as well as 
> for the subsequent files. And if we use line separator as part of header, the 
> first file seems ok but the first record in subsequent files comes out to be 
> empty with only commas.
> Copied from the SO post:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="warn" name="MyApp" packages="">
>     <Properties>
>         <Property name="audit-path">D:/watcher</Property>
>         <Property name="file-name">audit</Property>
>         <Property name="file-header">param1,param2,param3</Property>
>     </Properties>
>     <Appenders>
>     <RollingFile name="auditfile"
>         fileName="${audit-path}/${file-name}.tmp" 
> filePattern="${audit-path}/${file-name}-%d{yyyy-MM-dd}-%i.csv">
>         <CsvParameterLayout delimiter="," header="${file-header}">
>         </CsvParameterLayout>
>         <Policies>
>             <SizeBasedTriggeringPolicy size="80 B" />
>         </Policies>
>         <DefaultRolloverStrategy max="2"/>
>     </RollingFile>
> </Appenders>
> <Loggers>
>     <Root level="info">
>         <AppenderRef ref="auditfile" />
>     </Root>
> </Loggers>
> {code}



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

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