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

Ralph Goers updated LOG4J2-929:
-------------------------------
    Description: 
I have the below configuration of log4j2.xml. I'm trying to achieve the below, 
but without success.

a. To append date to the current file.
b. To roll over the file at midnight.

Could you please provide me with the info as of what is missing here.
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
  <Properties>
    <Property name = "log-path">c:/logs/</Property>
  </Properties>
  <Appenders>
    <RollingFile name="file" fileName="${log-path}/testapp.log" 
filePattern="testapp.%d{yyyy-MM-dd}.log" immediateFlush = "false">
      <PatternLayout>
        <Pattern>"%d{yyyy-MM-dd HH:mm:ss,SSS} [%-5p %C{1}] - %m%n</Pattern> 
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
      </Policies>
    </RollingFile>
    <Console name="console" target="SYSTEM_OUT">
      <PatternLayout pattern="%m%n"/>
    </Console>
  </Appenders>
  <Loggers>
    <Root level="debug">
      <AppenderRef ref="file" level="DEBUG"/>
      <AppenderRef ref="console" level="INFO"/>
    </Root>
  </Loggers>
</Configuration>
{code}


  was:
I have the below configuration of log4j2.xml. I'm trying to achieve the below, 
but without success.

a. To append date to the current file.
b. To roll over the file at midnight.

Could you please provide me with the info as of what is missing here.
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
        <Properties>
                <Property name = "log-path">c:/logs/</Property>
        </Properties>
        <Appenders>
                <RollingFile name="file" fileName="${log-path}/testapp.log" 
filePattern="testapp.%d{yyyy-MM-dd}.log" immediateFlush = "false">
                        <PatternLayout>
                                <Pattern>"%d{yyyy-MM-dd HH:mm:ss,SSS} [%-5p 
%C{1}] - %m%n</Pattern> 
                        </PatternLayout>
                        <Policies>
                                <TimeBasedTriggeringPolicy />
                        </Policies>
                </RollingFile>
                <Console name="console" target="SYSTEM_OUT">
                        <PatternLayout pattern="%m%n"/>
                </Console>
        </Appenders>
        <Loggers>
                <Root level="debug">
                        <AppenderRef ref="file" level="DEBUG"/>
                        <AppenderRef ref="console" level="INFO"/>
                </Root>
        </Loggers>
</Configuration>



> Roll over of log files
> ----------------------
>
>                 Key: LOG4J2-929
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-929
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>    Affects Versions: 2.1
>         Environment: Windows 8.1
>            Reporter: Gayu
>
> I have the below configuration of log4j2.xml. I'm trying to achieve the 
> below, but without success.
> a. To append date to the current file.
> b. To roll over the file at midnight.
> Could you please provide me with the info as of what is missing here.
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="DEBUG">
>   <Properties>
>     <Property name = "log-path">c:/logs/</Property>
>   </Properties>
>   <Appenders>
>     <RollingFile name="file" fileName="${log-path}/testapp.log" 
> filePattern="testapp.%d{yyyy-MM-dd}.log" immediateFlush = "false">
>       <PatternLayout>
>         <Pattern>"%d{yyyy-MM-dd HH:mm:ss,SSS} [%-5p %C{1}] - %m%n</Pattern> 
>       </PatternLayout>
>       <Policies>
>         <TimeBasedTriggeringPolicy />
>       </Policies>
>     </RollingFile>
>     <Console name="console" target="SYSTEM_OUT">
>       <PatternLayout pattern="%m%n"/>
>     </Console>
>   </Appenders>
>   <Loggers>
>     <Root level="debug">
>       <AppenderRef ref="file" level="DEBUG"/>
>       <AppenderRef ref="console" level="INFO"/>
>     </Root>
>   </Loggers>
> </Configuration>
> {code}



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