简体   繁体   中英

Packing the log using Enterprise Library 5.0 Logging Block

I am using the RollingFlatFileTraceListener to save the log files. Configuration of the listener is like this:

<listeners>
      <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        fileName="log/ReferentNet.log" footer="" formatter="Text Formatter"
        header="" rollFileExistsBehavior="Increment" rollSizeKB="1024"
        timeStampPattern="" maxArchivedFiles="10" traceOutputOptions="Callstack" />
</listeners>

The question is, can I somehow enable packing (eg into .zip files) of the archived files. I want roller not to simply roll the files, but to pack them except the last one.

This is rather a standard feature... For example, Poco Foundation library, which I use for my C++ projects, is capable of this.

I am pretty sure that is not a feature of the RollingFlatFileTraceListener or any other FlatFileTraceListener built into Enterprise Library. You would have to implement your own CustomTraceListener to enable file compression.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM