Menu ▾ ▴

#38 FileHandler won't append to first file

0.9.3.1
open
5
2014-11-19
2002-01-15
No

If you specify that a FileHandler should append to the
files it writes, it will never append to the first
file. Instead, it keeps increasing the uniqueness
number until it is able to successfully create a new
file and uses that file name pattern as the basis for
all its file names.

Note that this need for appending to the first file
seems to conflict with the uniqueness pattern which is
used to avoid conflicts with other programs logging to
log files. How do we know that we aren't in conflict
with some other program which chooses to append to the
same file as we decide to append to?

Discussion

  • Ken Gentle

    Ken Gentle - 2002-01-15

    Logged In: YES
    user_id=410220

    By "locking" the file - the only way I know of to pull this
    off with some degree of platform independence is to create
    a "lock" file on every file open (probably in the same dir
    as the log file) and check for its existence before
    appending.

    If the first file is present and not locked, the lock it
    and append. Otherwise the file cannot be appended to - so
    now what? Fail? Increment the uniqueness number and try
    again? I need to go study the spec on that one...

     
  • Brian R. Gilstrap

    • milestone: --> 0.9.3.1
    • assigned_to: nobody --> gilstrap
     
  • Daniel Bratell

    Daniel Bratell - 2002-05-15

    Logged In: YES
    user_id=306784

    Why not keep the filestream open all the time. That way
    noone else can log to that file. If trying to open a file
    for writing failed lumberjack can try another file name.

     

Log in to post a comment.