Skip to content

Commit

Permalink
#125 fixed exception when no file appender in log config
Browse files Browse the repository at this point in the history
  • Loading branch information
yar229 committed Oct 16, 2019
1 parent ad7598c commit 7e56f13
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions WDMRC.Console/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ public static XmlElement Log4Net
get
{
var e = (XmlElement) Document.SelectSingleNode("/config/log4net");
var nz = e.SelectNodes("appender/file");
foreach (XmlNode eChildNode in nz)
{
var attr = eChildNode.Attributes["value"];
if (attr != null)
attr.Value = attr.Value
.Replace('/', Path.DirectorySeparatorChar)
.Replace('\\', Path.DirectorySeparatorChar);
}
var nz = e?.SelectNodes("appender/file");
if (nz != null)
foreach (XmlNode eChildNode in nz)
{
var attr = eChildNode.Attributes?["value"];
if (attr != null)
attr.Value = attr.Value
.Replace('/', Path.DirectorySeparatorChar)
.Replace('\\', Path.DirectorySeparatorChar);
}
return e;
}
}
Expand Down

0 comments on commit 7e56f13

Please sign in to comment.