DiskSpaceExhaustedOption 枚举

定义

确定在 FileLogTraceListener 对象尝试写入日志而可用磁盘空间小于 ReserveDiskSpace 属性所指定的空间时应采取的操作。Determines what to do when the FileLogTraceListener object attempts to write to a log and there is less free disk space available than specified by the ReserveDiskSpace property.

public enum class DiskSpaceExhaustedOption
public enum DiskSpaceExhaustedOption
type DiskSpaceExhaustedOption = 
Public Enum DiskSpaceExhaustedOption
继承
DiskSpaceExhaustedOption

字段

DiscardMessages 1

丢弃日志消息。Discard log messages.

ThrowException 0

引发异常。Throw an exception.

注解

DiskSpaceExhaustedBehavior当属性设置为 DiscardMessages 时, 如果没有足够的保留磁盘空间, 则默认情况下会丢弃日志消息。When the DiskSpaceExhaustedBehavior property is set to DiscardMessages, the log messages are by default discarded if there is not enough reserved disk space. 这会阻止简单的应用程序在磁盘太满时失败。This prevents simple applications from failing if the disk gets too full.

对于更可靠的应用程序, 请DiskSpaceExhaustedBehavior将属性设置为 ThrowException, Try...Catch并在写入日志的所有代码周围添加块。For a more robust application, set the DiskSpaceExhaustedBehavior property to ThrowException, and add Try...Catch blocks around all code that writes to the log.

适用于

另请参阅