why 2 log files getting created when date changes

when i am running a batch [spring-batch] , and if the system date chages
two log files getting created.
i have shared my file appender.

for example :

when i started my batch at 23.45 [today 05-01-12] it will created a log with todays date
and when date changes, it will create a one more log file [tommorow 06-01-12] and start appending to that new log file.

i am expecting only one log file for my batch regardless of time when batch started.


MyFileAppender.java
nkk1712Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nkk1712Author Commented:
and this is my log4j.xml file

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

      <appender name="FILE" class="caf.opm.cpm.feed.common.utils.OpmDailyRollingFileAppender">
            <param name="directory" value="D:\\Homeware\\CPMFeeds\\logs\\" />
            <param name="prefix" value="${feed.name}-" />
            <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern"
                        value="%-5p - %d - %C{1}.%M(%L) | %m%n" />
            </layout>
      </appender>
      
      <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
            <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern"
                        value="%-5p - %d (%-10.10t)- %C{1}.%M(%L) | %m%n" />
            </layout>
            <filter class="org.apache.log4j.varia.LevelRangeFilter">
              <param name="levelMin" value="INFO"/>
              <param name="levelMax" value="FATAL"/>
           </filter>
      </appender>

      <logger name="org.hibernate">
            <level value="ERROR" />
      </logger>

      <logger name="org.springframework">
            <level value="ERROR" />
      </logger>
      
      <logger name="dfi.fin.dcm.techfwk">
            <level value="INFO" />
      </logger>
      
      <logger name="caf.opm.cpm">
            <level value="INFO" />
      </logger>

      <root>
            <level value="ERROR" />
            <appender-ref ref="CONSOLE" />
            <appender-ref ref="FILE" />
      </root>
      
</log4j:configuration>
0
gordon_vt02Commented:
It looks like the append() method in your logger creates the new file when the date rolls.  What functionality is missing from the standard DailyRollingFileAppender that you need to create a custom one?  From the sounds of it, you don't want a Rolling appender anyway, the requirement you described lends itself to just using the basic FileAppender, which will log to a single file.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.