Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have used log4net before where there was no need to write any code just do some configuration in config file to log the errors. Now i want to do same using Nlog but couldnt achieve this . Can some show me sample how to log using Nlog. I tried below code in config file
<nlog>
    <targets>
      <target name="file"  layout="${longdate} ${logger} ${message}" filename="${basedir}/logs/logfile.txt" xmlns:xsi="#unknown" />
    </targets>
   <rules>
        <logger name="*" minlevel="Off" writeto="file" />
    </rules>
  </nlog>

and tried to raise error in controller but its not creating log file. Is anything wrong in above code
Posted
Updated 15-Apr-15 3:41am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900