a few more follow up changes in 1.11

pull/4/head v1.11
Kohsuke Kawaguchi 2011-10-27 11:21:11 -07:00
parent c2ee1d585d
commit 98a12b70ff
1 changed files with 8 additions and 3 deletions

View File

@ -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);
}
}