I am implementing logging in my app via NLog. This is my 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">
<targets async="true">
<target xsi:type="File"
name="ExceptionTarget"
fileName="LOG.txt"
layout="${date:format=dd MMM yyyy HH-mm-ss} ${uppercase:${level}} ${newline}${message} ${exception::maxInnerExceptionLevel=5:format=ToString}${newline}${stacktrace}${newline}"/>
</targets>
<targets async="true">
<target xsi:type="File"
name="InfoTarget"
fileName="LOG.txt"
layout="${date:format=mm-ss} ${uppercase:${level}} ${newline}${message} ${newline}"/>
</targets>
<rules>
<logger name="*" level="Error" writeTo="ExceptionTarget"/>
<logger name="*" level="Info" writeTo="InfoTarget"/>
</rules>
</nlog>
When I deploy the app out with ClickOnce, no log.txt file is being created. No errors occur, and my app runs as normal, but nothing is happening.
How to solve this problem?
The ClickOnce installer is not deploying the NLog.config file when the software is installed, so your app do not have any logging configuration.
Solution: