Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top