Browse Source

a few more follow up changes in 1.11

Kohsuke Kawaguchi 14 years ago
parent
commit
98a12b70ff
1 changed files with 8 additions and 3 deletions
  1. 8 3
      ServiceDescriptor.cs

+ 8 - 3
ServiceDescriptor.cs

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