新建windows phone应用程序,然后添加空的Nlog.config项,然后添加如下
我在Nlog.config里面这样写的:
<?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">
<!-- make sure to set 'Copy To Output Directory' option for this file -->
<!-- go to http://nlog-project.org/wiki/Configuration_file for more information -->
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/${level}.log" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
</rules>
</nlog>
然后在MainPage的构造函数里面写了
private static NLog.Logger logger = NLog.LogManager.GetLogger("MainPage");
logger.Trace("This is a Trace message");
logger.Debug("This is a Debug message");
logger.Info("This is an Info message");
运行程序之后,我发现整个项目里面都没有任何.log文件,怎么查看则个日志文件啊?是不是我哪里写错了啊,可是网上写的都是这样的啊,希望高手能帮帮我,谢谢了