Enterprise Library Logging - Specific Requirement

Topics: Logging Application Block
Sep 3, 2014 at 10:34 AM
I have just started investigating the Enterprise Library Logging Block to be used to replace a custom written logger and have the a specific requirement on the logging that dictates that they must be split into hourly logs in a daily subfolder (e.g. C:\Temp\logs\20140902\TraceLog13.log).

Can someone confirm if this is possible with the Rolling Flat File Trace Listener or would I need to continue with my custom solution?
Sep 4, 2014 at 2:53 AM
Edited Sep 4, 2014 at 2:55 AM
The Rolling Flat File Trace Listener does support a RollInterval of Hour. However, it doesn't support writing to a daily sub-folder.

One way to achieve what you want would be to create a custom trace listener to implement the daily sub-folder functionality. This should be a small change from the existing implementation. You could base the custom trace listener on the existing source code or use the Rolling XML Trace Listener Sample & (Rolling) Flat File Trace Listeners on the Enterprise Library V6 Sample Projects Page (which is itself based on the existing source).

For a more structured approach to logging you might also want to consider using the Semantic Logging Application Block instead of the Logging Application Block.

Randy Levy
Enterprise Library support engineer
Support How-to