Log4net - How to know when a file is rolled?

前端 未结 1 1821
深忆病人
深忆病人 2021-01-25 05:36

I have a log file created by log4net which changes every hour. Is there a way to know when this roll occurs? Like an event in the log4net lib to which I could bind, and perform

相关标签:
1条回答
  • 2021-01-25 06:40

    I guess you are using RollingFileAppender.
    In this case you would need to use your own appender inheriting from RollingFileAppender and overwrite RollOverRenameFiles to do your logic plus the original implementation.
    RollOverTime would be the time. As these are protected, you need to create your own implementation using inheritance.
    See RollingFileAppender documentation for the details.

    0 讨论(0)
提交回复
热议问题