web.configにNlog設定を踏襲し、変換構文を使ってソリューション構成ごとに異なるログ設定をする
アクション 最初に以下を宣言する。 これで、ソースコードにはログを貼るだけでよくなる。 <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/> </configSections> あとは、targetとruleを付けるだけ。 全体像は以下の通り。 Web.config <configuration> <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/> </configSections> <nlog> <targets> <target name="logFile" type="File" fileName="./logs/${shortdate}-debug.log" encoding="UTF-8" archiveFileName="${basedir}/logs/archives/archive.${shortdate}-debug.log" archiveEvery="Day" archiveNumbering="Rolling" maxArchiveFiles="365" layout="${longdate},${uppercase:${level}},${callsite},${callsite-linenumber},${message}"/> <!-- <target name=...