Re: Handling a change in system date



james schrieb:
I'm relatively new to java so I apologise if this is a simple
question. I am trying to detect when the system date changes so that I
can start a new log file for each day. I have setup the code to create
a new log file etc. however I can't seem to find any information on
how to detect changes in the system date. I am only interested in when
the day changes (not the time etc.) and I have looked into change
listeners however I'm not sure if this is the right approach or not?

Can anyone please point me in the right direction, or even better to a
good tutorial on how to do this!

Christian wrote:
<http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html>

Aside from the obvious answer, if you must roll your own, have the appender check the date of the file before writing to it. If it's from the previous day, open a new file.

--
Lew
.



Relevant Pages

  • Re: Handling a change in system date
    ... I'm relatively new to java so I apologise if this is a simple ... can start a new log file for each day. ...
    (comp.lang.java.programmer)
  • Re: Multi-Threading
    ... 100,000+ line log file and decided to use multi-threading as a solution to ... Multi-threading on the desktop is useful when you're executing long running ... getting the info is a problem or is writing it the database, ... Do Until intcount> intcount1 ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Set Trace to Ignore Errors in Trace.WriteLine?
    ... opened and locked - other processes should not be able to lock ... The problem appears to be something reading the log file not writing to it. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Hard Drive Space
    ... of the distribution, ... security problems it had over the life of the distribution. ... in the space, either the box is 0wn3d, or you have a process that is writing ... If you don't recall removing some log file manually, ...
    (linux.redhat)
  • Re: Logrotate is a pain
    ... >>important feature is that the program, which writes the logfiles does ... > to have missed is that if you rename an open log file, ... > writing to it continues writing to it regardless of the name. ... You can simply put a simple line in it to send SIGHUP to your daemon and the ...
    (comp.os.linux.misc)