thank you for your concern

but it seems like neither RollingFileAppender nor
RollingRandomAccessFileAppender
<https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingRandomAccessFileAppender>
could
not create currently appending file name with datePattern.
just create fileName and moved with rolling pattern.

with is configuration
<RollingFile name="RollingFile" fileName="${log-path}/myexample.log"
filePattern="${log-path}/myexample-%d{yyyy-MM-dd}.log" >
it will create "myexample.log" and write on that until date changed. after
date changed then, it moved to "myexample.2015-07-31.log" with pattern.

but I want to create appending log file with every day's date patterned.
myexample.2015-07-31.log
myexample.2015-08-01.log

"myexample.log" should not exist.

this not working.
<RollingFile name="RollingFile"
fileName="${log-path}/myexample-%d{yyyy-MM-dd}.log"
filePattern="${log-path}/myexample-%d{yyyy-MM-dd}.log" >
this will create file "myexample-%{yyyy-MM-dd}.log" not
"myexample-205-07-31"

I hope you can understand me.


similar post.
http://stackoverflow.com/a/8888867

thanks.

2015-07-31 10:11 GMT+09:00 Gary Gregory <[email protected]>:

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



-- 
----------------------------------------------
Jihun No ( 노지훈 )
----------------------------------------------
Twitter          : @nozisim
Facebook       : nozisim
Website         : http://jeesim2.godohosting.com
---------------------------------------------------------------------------------
Market Apps   : android market products.
<https://market.android.com/developer?pub=%EB%85%B8%EC%A7%80%ED%9B%88>

Reply via email to