After installation, we use the documentation on NLog ( https://github.com/nlog/nlog/wiki/Tutorial ) and add to Web.config
The answer to the question is web.config .
It turns out something like this:
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /> <!-- ... ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ Π΄ΡΡΠ³ΠΈΡ
ΡΠ΅ΠΊΡΠΈΠΉ ... --> </configSections> <!-- ... Π΄ΡΡΠ³ΠΈΠ΅ ΡΠ΅ΠΊΡΠΈΠΈ ... --> <nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets> <target name="logfile" xsi:type="File" fileName="C://file.txt" /> </targets> <rules> <logger name="*" minlevel="Info" writeTo="logfile" /> </rules> </nlog> </configuration>
Or you can configure different log output options:
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /> <!-- ... ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ Π΄ΡΡΠ³ΠΈΡ
ΡΠ΅ΠΊΡΠΈΠΉ ... --> </configSections> <!-- ... Π΄ΡΡΠ³ΠΈΠ΅ ΡΠ΅ΠΊΡΠΈΠΈ ... --> <nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <variable name="logDirectory" value="${basedir}/Content/logs/${shortdate}" /> <targets> <target name="TcpOutlet" xsi:type="NLogViewer" address="tcp4://localhost:4505"/> <target name="fileLogTrace" xsi:type="File" fileName="${logDirectory}/trace.txt" /> <target name="fileLogDebug" xsi:type="File" fileName="${logDirectory}/debug.txt" /> <target name="fileLogInfo" xsi:type="File" fileName="${logDirectory}/info.txt" /> <target name="fileLogErrors" xsi:type="File" fileName="${logDirectory}/errors.txt" /> </targets> <rules> <logger name="*" level="Info" writeTo="TcpOutlet" /> <logger name="*" level="Trace" writeTo="fileLogTrace" /> <logger name="*" level="Debug" writeTo="fileLogDebug" /> <logger name="*" level="Info" writeTo="fileLogInfo" /> <logger name="*" minlevel="Warn" writeTo="fileLogErrors" /> </rules> </nlog> </configuration>