I want to use RollingMode.Date to log by date. But default interval is one minute. I looked into source and saw, that class has protected enum RollPoint

/// <summary>
/// The code assumes that the following 'time' constants are in a increasing sequence.
/// </summary>
/// <remarks>
/// <para>
/// The code assumes that the following 'time' constants are in a increasing sequence.
/// </para>
/// </remarks>
protected enum RollPoint
{
    InvalidRollPoint = -1,
    TopOfMinute,
    TopOfHour,
    HalfDay,
    TopOfDay,
    TopOfWeek,
    TopOfMonth
}

How to specify RollPoint to RollingFileAppender object?

Thanks!

有帮助吗?

解决方案

You can use datePattern property of log configuration.

To change the rolling period adjust the DatePattern value. For example, a date pattern of "yyyyMMdd" will roll every day. See System.Globalization.DateTimeFormatInfo for a list of available patterns.

It narrows down to adding

<datePattern value="yyyyMMdd-HHmm" />

to your appender configuration. More information here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top