Repository: mkdocs/mkdocs

Issue:
WARNING messages accumulate (increase) each time change is detected and reloaded when using "mkdocs serve"
I used a "theme" which is "flatly". When I make a change to the file, from the command-line, the dev server will automatically reload, but the warning message is accumulated. After a lot of writes, the repeated warning messages is all over the terminal.

```
$ mkdocs serve
INFO    -  Building documentation... 
WARNING -  Config value: 'theme'. Warning: The theme 'flatly' will be removed in an upcoming MkDocs release. See http://www.mkdocs.org/about/release-notes/ for more details 
[I 150611 21:12:01 server:271] Serving on http://127.0.0.1:8000
[I 150611 21:12:01 handlers:58] Start watching changes
[I 150611 21:12:01 handlers:60] Start detecting changes
INFO    -  Building documentation... 
WARNING -  Config value: 'theme'. Warning: The theme 'flatly' will be removed in an upcoming MkDocs release. See http://www.mkdocs.org/about/release-notes/ for more details 
WARNING -  Config value: 'theme'. Warning: The theme 'flatly' will be removed in an upcoming MkDocs release. See http://www.mkdocs.org/about/release-notes/ for more details 
[I 150611 21:12:11 handlers:131] Browser Connected: http://127.0.0.1:8000/apue/ch3/#lseek-function
INFO    -  Building documentation... 
WARNING -  Config value: 'theme'. Warning: The theme 'flatly' will be removed in an upcoming MkDocs release. See http://www.mkdocs.org/about/release-notes/ for more details 
WARNING -  Config value: 'theme'. Warning: The theme 'flatly' will be removed in an upcoming MkDocs release. See http://www.mkdocs.org/about/release-notes/ for more details 
WARNING -  Config value: 'theme'. Warning: The theme 'flatly' will be removed in an upcoming MkDocs release. See http://www.mkdocs.org/about/release-notes/ for more details 
[I 150611 21:12:47 handlers:91] Reload 1 waiters: /Users/shichao/Documents/personal/projects/notes/docs/apue/ch3.md
[I 150611 21:12:47 handlers:131] Browser Connected: http://127.0.0.1:8000/apue/ch3/#lseek-function
...
```

I encountered the problem in 0.14.0 release. I used the master branch to reproduce the same result.



Discussion:
Hmm, interesting. I had seen this before and thought I fixed all occurences of it. Basically I think it means that the logging handler is being added on each reload and thus the warning is displayed multiple times. I can see an obvious reason why this is happening.


Resolving patch:
diff --git a/mkdocs/config/base.py b/mkdocs/config/base.py
--- a/mkdocs/config/base.py
+++ b/mkdocs/config/base.py
@@ -51,6 +51,7 @@ def _validate(self):
                 value = self.get(key)
                 self[key] = config_option.validate(value)
                 warnings.extend([(key, w) for w in config_option.warnings])
+                config_option.reset_warnings()
             except ValidationError as e:
                 failed.append((key, e))
 
diff --git a/mkdocs/config/config_options.py b/mkdocs/config/config_options.py
--- a/mkdocs/config/config_options.py
+++ b/mkdocs/config/config_options.py
@@ -17,6 +17,9 @@ def is_required(self):
     def validate(self, value):
         return self.run_validation(value)
 
+    def reset_warnings(self):
+        self.warnings = []
+
     def pre_validation(self, config, key_name):
         """
         After all options have passed validation, perform a post validation


Test patch: