我最近在一個ASP.Net項目中爲Nlog使用了一個成功的客戶端。我需要連接到具有自己的事件日誌管理的現有應用程序,併爲他們提供我的日誌信息的副本。NLog在C#中獲取消息
有什麼辦法讓我使用任何日誌功能提供給Nlog的字符串?
例子:
logger.Info("My info");
logger.Debug("My debug");
logger.Error("My error");
logger.Warn("My warn");
List<string> messages = logger.getStrings() <-- this is what I need
我怎樣才能得到字符串「我的信息」,「我的調試」,「我的錯誤」和「我的提醒」數組或列表<>?
是你的日誌?這將是從另一個應用程序獲取日誌數據的最簡單方法。你也可以使用'MemoryAppender'並獲得它的內部緩衝區。 – Amy
@amy'MemoryAppender'?聽起來像log4net? – Julian
@Julian哎呀,我正在引導我的內部NLog。 – Amy