I see uses of logging inside the HangFire source code such as: "Logger.Info() " and “Logger.InfoFormat()”, but where are these logged statements stored and where do we specify these logged statements to be stored?
Here is a copy of our nlog configuration.
<?xml version="1.0" encoding="utf-8"?>
<nlog autoReload="true" throwExceptions="false" internalLogFile="nlog.log" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="Console"
xsi:type="ColoredConsole"
layout="${level} >> ${message}"
errorStream="false" />
<target name="traceLogger"
type="file"
fileName="${basedir}/logs/traceLogger.log"
concurrentWrites="false"
keepFileOpen="false"
archiveFileName="${basedir}/logs/archives/traceLogger.{#}.log"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="1">
<layout type="CsvLayout">
<header type="CsvLayout">
<delimiter>Semicolon</delimiter>
<quoting>Auto</quoting>
<column layout="Timestamp" />
<column layout="Logger" />
<column layout="Level" />
<column layout="Message" />
<column layout="Stack" />
</header>
<delimiter>Semicolon</delimiter>
<quoting>Auto</quoting>
<column layout="${longdate:universalTime=true}" />
<column layout="${logger}" />
<column layout="${level}" />
<column layout="${message}" />
<column layout="${stacktrace}" />
</layout>
</target>
<target name="serviceLogger"
type="file"
fileName="${basedir}/logs/serviceLogger.log"
concurrentWrites="false"
keepFileOpen="false"
archiveFileName="${basedir}/logs/archives/serviceLogger.{#}.log"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7">
<layout type="CsvLayout">
<header type="CsvLayout">
<delimiter>Semicolon</delimiter>
<quoting>Auto</quoting>
<column layout="Timestamp" />
<column layout="Level" />
<column layout="Message" />
<!--<column layout="Stack" />-->
</header>
<delimiter>Semicolon</delimiter>
<quoting>Auto</quoting>
<column layout="${longdate:universalTime=true}" />
<column layout="${level}" />
<column layout="${message}" />
<!--<column layout="${stacktrace}" />-->
</layout>
</target>
<target
name="exceptionLogger"
type="file"
fileName="${basedir}/logs/exceptionLogger.log"
concurrentWrites="false"
keepFileOpen="false"
archiveFileName="${basedir}/logs/archives/exceptionLogger.{#}.log"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7">
<layout type="CsvLayout">
<header type="CsvLayout">
<delimiter>Semicolon</delimiter>
<quoting>Auto</quoting>
<column layout="Timestamp" />
<column layout="Level" />
<column layout="Logger" />
<column layout="Message" />
<column layout="Exception" />
</header>
<delimiter>Semicolon</delimiter>
<quoting>Auto</quoting>
<column layout="${longdate:universalTime=true}" />
<column layout="${level}" />
<column layout="${logger}" />
<column layout="${message}" />
<column layout="${exception:format=tostring}" />
</layout>
</target>
</targets>
<rules>
<!-- Note: There is a transformation for debug! -->
<!-- everything in one log -->
<!--<logger name="*" writeTo="traceLogger" minLevel="Trace" />-->
<!-- exceptipons only -->
<logger name="*" writeTo="exceptionLogger" minLevel="Error" />
<!-- Analyzer service logs e.g. starting, shutting down, HangFire, etc -->
<logger name="Hangfire.*" writeTo="serviceLogger" minLevel="Info" />
</rules>
What’s the value of “{basedir}”? I’ve integrated GitHub\Hangfire\Hangfire.sln (downloaded from Github) into my existing VS solution and referenced the HangFire source code in my VS project successfully.