⌘BABAKOV.NET Let's code!
100% [light] [ru]
~/tags/logirovanie $

#логирование

1 posts

1 total

Adding Logging to .NET Core Web Application with NLog

Example of adding logging to a .NET Core Web application based on NLog. Initially, add the NLog.Web.AspNetCore package via Nuget. Then add a nlog.config file to the project root with the following content: <?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" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="true"> <targets> <target name="file" xsi:type="FileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}" /> </targets> </nlog>

234 views 0 comments 0 likes ./Read →