To monitor how long the log entries take 監視日志條目的長度
TextFormatter formatter = TextFormatter( xmlFormatterAttributes = xmlFormatterAttributes[] = xmlFormatterAttributes[] = EnoughPI.Logging.Formatters.XmlFormatter xmlFormatter = eventLog = EventLog(, , eventLogTraceListener = flatFileTraceListener = config = }
To use a trace listener asynchronously 使用異步Trace Listener
TextFormatter formatter = TextFormatter( {severity}{newline}Title:{title}{newline} flatFileTraceListener = FlatFileTraceListener( config = (flatFileTraceListener); config.IsTracingEnabled = }
FlatFileTraceListener allows you to use that Trace Listener to log messages asynchronously. This will be most useful when writing large volumes of messages to a flat file or database. 包裝已有的FlatFileTraceListener使你可以使用TraceListener來異步的記錄消息。這在記錄大量日志消息到文件或數據庫時是非常有用的。
Logging messages asynchronously can lead to messages being lost if the application terminates before the buffer is drained. Disposing the LogWriter when shutting down the application attempts to flush all asynchronous buffers.
如果程序在緩沖區被排空之前就被終止了,那麼異步記錄消息可能會導致消息丟失。在關閉程序時處理LogWriter嘗試處理所有的異步緩沖區。