在Assets文件夹中添加nlog.config文件,在属性中将Build Action设置为AndroidAsset
nlog.config
AndroidAsset
var steam = Assets.Open("nlog.config"); var xmlReader = System.Xml.XmlReader.Create(steam); NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(xmlReader, null);
NLog在Xamarin Android中的配置