Force Rollover of Rolling Flat File

Topics: Logging Application Block
Nov 1, 2010 at 9:19 PM

We are using Enterprise Library 5.0 Rolling Flat File Trace Listener.  We have a situation where we would like to force the rollover behavior to happen so that it can move the contents from the "default" file to one with the timestamp on it.  Is there a way to do this? 

Longer description is this:  We are writing records to a default log file name.  When the file rolls over and renames the current file to one with a timestamp on it and creates a new default file, another process sees that and picks up the timestamped file and processes it.  For our automated testing, we want to be able to write 1 record to the file, then have the process pick it up and process it.  However, no matter how small we set the RollInterval (min of 1 minute) or RollSizeKB, it doesn't roll the file until the NEXT time it is called.  So, the record we wrote sits in the log file until another line is written.  We can write another record into the log file which will produce the log rolling behavior, but now we have an extra record in there that we don't want to process.

So, ultimately, we would like a way to say, "Rollover the file NOW".  Is there any way to do that?


Nov 2, 2010 at 12:46 AM

There isn't.  You would need to create a custom trace listener for that.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.