mirror of https://github.com/winsw/winsw
parent
c2ee1d585d
commit
98a12b70ff
|
@ -233,7 +233,7 @@ namespace winsw
|
|||
{
|
||||
get
|
||||
{
|
||||
string mode;
|
||||
string mode=null;
|
||||
|
||||
// first, backward compatibility with older configuration
|
||||
XmlElement e = (XmlElement)dom.SelectSingleNode("//logmode");
|
||||
|
@ -242,9 +242,12 @@ namespace winsw
|
|||
} else {
|
||||
// this is more modern way, to support nested elements as configuration
|
||||
e = (XmlElement)dom.SelectSingleNode("//log");
|
||||
mode = e.GetAttribute("mode");
|
||||
if (e!=null)
|
||||
mode = e.GetAttribute("mode");
|
||||
}
|
||||
|
||||
if (mode == null) mode = "append";
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case "rotate":
|
||||
|
@ -272,8 +275,10 @@ namespace winsw
|
|||
return new SizeBasedRollingLogAppender(LogDirectory, BaseName, sizeThreshold, keepFiles);
|
||||
|
||||
case "append":
|
||||
default:
|
||||
return new DefaultLogAppender(LogDirectory, BaseName);
|
||||
|
||||
default:
|
||||
throw new InvalidDataException("Undefined logging mode: " + mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue