.netloggingenterprise-libraryenterprise-library-5logging-application-block

Enterprise Library 5.0 Logging - rollInterval


Can the Enterprise Library 5.0 Logging Application Block be configured to roll the log file every day at a specified time (e.g. at 3:00 PM)?

The relevant options of rollInterval are day and midnight. I'm not sure what the difference is, but midnight certainly isn't the right choice, and I don't see how to configure at what hour to perform a roll when using day (is it actually identical to midnight?).


Solution

  • If the RollInterval is set to Midnight the log file will roll after midnight (i.e. the next day). If the RollInterval is set to Day then the log file will roll after a full day has passed since the log file was created (i.e. 24 hours from the start).

    I don't believe that the LoggingApplication Block has a setting to roll the log file at a specific time. If you wanted that functionality, you would have to create a custom Trace Listener (which can be based on the existing Rolling Flat File Trace Listener).

    The Caching Application Block provides an ExtendedFormat for cache item expirations that could be used as the basis of a more flexible rolling file "expiration" scheme.