0
是否可以通過代碼更改source
名稱?我的解決方案有幾個模塊,我想在查看日誌時將它們分開。NLog:是否可以從代碼更改源名稱?
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="EventLog" name="eventlog" layout="${message}" log="Application" source="MyAwesomeSolution"/>
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="eventLog" />
</rules>
</nlog>
另外,如何將對象記錄爲xml?例如如果我這樣做 - logger.Info("Results - {0}", person);
我想在我的事件日誌中將person
對象視爲XML。可能嗎?
謝謝。我會試一試。 – tempid