Hun, Please see https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingRandomAccessFileAppender
Gary On Thu, Jul 30, 2015 at 5:26 PM, no jihun <[email protected]> wrote: > Hello, > > I want log4j to write at file which current date postfixed. > > for example, if today is 2015-07-31 > - expected file name created : logs/test.log.2015-07-31 > - (not this one : logs/test.log) > > when I use log4j I could do that by following. > <appender name="testLog" > class="org.apache.log4j.rolling.RollingFileAppender"> > <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> > <param name="FileNamePattern" value="/home/logs/test.log.%d{yyyy-MM-dd}" /> > </rollingPolicy> > <layout class="org.apache.log4j.PatternLayout"> > <param name="ConversionPattern" value="%m%n" /> > </layout> > </appender> > > TimeBasedRollingPolicy is class in apache-log4j-extras.jar > This configuration make It's down dated log file at the beginning of > every new day. > > > How can I do this with* log4j2*'s org.apache.logging.log4j.core.appender. > RollingFileAppender? > > Thanks! > Hun > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
