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