Fixed the logger no longer writing to the file.

pull/98/head
tidusjar 9 years ago
parent 009034012f
commit 6940311b29

@ -97,6 +97,18 @@ namespace PlexRequests.Helpers
var rule1 = new LoggingRule("*", LogLevel.Info, databaseTarget);
config.LoggingRules.Add(rule1);
var fileTarget = new FileTarget
{
Name = "file",
FileName = "logs/${shortdate}.log",
Layout = "${date} ${logger} ${level}: ${message} ${exception:tostring}",
CreateDirs = true
};
config.AddTarget(fileTarget);
var rule2 = new LoggingRule("*", LogLevel.Trace, fileTarget);
config.LoggingRules.Add(rule2);
// Step 5. Activate the configuration
LogManager.Configuration = config;
}

@ -13,22 +13,8 @@
layout="${date} ${logger} ${level}: ${message}" />
<!--<target name="Database" xsi:type="Database"
dbProvider="Mono.Data.Sqlite.SqliteConnection, Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" keepConnection="false"
connectionString="Data Source=PlexRequests.sqlite, version=3"
commandText="INSERT into Logs(Date, Level, Logger, Callsite, Message, Exception)
values(@Date, @Loglevel, @Logger, @Callsite, @Message, @Exception)">
<parameter name="@Date" layout="${longdate}"/>
<parameter name="@Loglevel" layout="${level:uppercase=true}"/>
<parameter name="@Logger" layout="${logger}"/>
<parameter name="@Callsite" layout="${callsite:filename=true}"/>
<parameter name="@Message" layout="${message}"/>
<parameter name="@Exception" layout="${exception:format=tostring}"/>
</target>-->
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="filelog" />
<!--<logger name="*" minlevel="Trace" writeTo="Database" />-->
</rules>
</nlog>
Loading…
Cancel
Save