I would like to add a memory appender to the root logger so that I can connect to the application and get the last 10 events. I only ever want to keep the last 10. I am worried about this appender consuming all too much memory. The application is designed to run 24/7. Or is there another way?
相关问题
- 最新的log4net是不是不支持写入到mysql了。
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
相关文章
- 最新的log4net是不是不支持写入到mysql了。
- .net中MessageBox.Show使用问题
- IdentityServer 报错:"idp claim is missing"
- 在 IdentityServer 中如何给 id token 添加更多信息
- IdentityServer 的 Selector 在哪个 nuget 包
- 使用 IdentityServer 的项目遭遇错误:"IDX20803: Unable to obt
- ASP.NET Core ConfigureServices 中从 appsettings.json
- .netCore 控制台程序输出配置问题
You would need to create a custom appender to store a limited number of logs. For example the
MemoryAppender
could be subclassed as follows:I guess, you may need to create a custom Appender class that derives from
MemoryAppender
and overrides the output storage by counting the number of messages currently displayed. You can store messages in a list, and, in theAppend
method, determine if the list already has maximum number of messages. If so, you delete the oldest message and add the new one to the list.