Skip to content
This repository
Browse code

Back ported logging fix to branch.

Fixed some import errors.

-Mikeal



git-svn-id: http://svn.getwindmill.com/branches/dot-two-refactor@209 78c7df6f-8922-0410-bcd3-9426b1ad491b
  • Loading branch information...
commit bc34566eaa235d1390cb9c9bccf0dce94644302f 1 parent 48cbb84
Mikeal Rogers authored July 05, 2007
15  windmill/bin/admin_lib.py
@@ -72,7 +72,8 @@ def process_options(argv_list):
72 72
 
73 73
 def setup_servers(console_level=logging.INFO):
74 74
     """Setup the server and return httpd and loggers"""
75  
-    console_handler = windmill.server.logger.setup_root_logger(console_level=console_level)
  75
+    console_handler = logging.getLogger().handlers[0]
  76
+    console_handler.setLevel(console_level)
76 77
     httpd = windmill.server.wsgi.make_windmill_server()
77 78
     return httpd, console_handler
78 79
 
@@ -89,6 +90,14 @@ def run_threaded(console_level=logging.INFO):
89 90
 
90 91
 def configure_global_settings():
91 92
     # Get local config
  93
+    
  94
+    logging.getLogger().setLevel(0)
  95
+    
  96
+    console = logging.StreamHandler()
  97
+    console.setLevel(logging.INFO)
  98
+    formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
  99
+    console.setFormatter(formatter)
  100
+    logging.getLogger().addHandler(console)
92 101
 
93 102
     if os.environ.has_key('WINDMILL_CONFIG_FILE'):
94 103
         sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.expanduser(os.environ['WINDMILL_CONFIG_FILE']))))
@@ -142,8 +151,11 @@ def setup():
142 151
 
143 152
 
144 153
 def teardown(shell_objects):
  154
+    
  155
+    shell_objects['clear_queue']()
145 156
 
146 157
     for controller in windmill.settings['controllers']:
  158
+        controller.stop()
147 159
         del(controller)
148 160
 
149 161
     while shell_objects['httpd_thread'].isAlive():
@@ -168,7 +180,6 @@ def runserver_action(shell_objects):
168 180
         teardown(shell_objects)
169 181
 
170 182
 def shell_action(shell_objects):
171  
-
172 183
     # If ipython is installed and we weren't given the usecode option
173 184
     try:
174 185
         from IPython.Shell import IPShellEmbed
2  windmill/server/__init__.py
@@ -12,4 +12,4 @@
12 12
 #   See the License for the specific language governing permissions and
13 13
 #   limitations under the License.
14 14
 
15  
-import jsonrpc, logger, wsgi, convergence
  15
+import jsonrpc, wsgi, convergence
42  windmill/server/logger.py
... ...
@@ -1,42 +0,0 @@
1  
-#   Copyright (c) 2006-2007 Open Source Applications Foundation
2  
-#
3  
-#   Licensed under the Apache License, Version 2.0 (the "License");
4  
-#   you may not use this file except in compliance with the License.
5  
-#   You may obtain a copy of the License at
6  
-#
7  
-#       http://www.apache.org/licenses/LICENSE-2.0
8  
-#
9  
-#   Unless required by applicable law or agreed to in writing, software
10  
-#   distributed under the License is distributed on an "AS IS" BASIS,
11  
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  
-#   See the License for the specific language governing permissions and
13  
-#   limitations under the License.
14  
-
15  
-import logging
16  
-
17  
-def setup_root_logger(console_level=logging.NOTSET, file_level=logging.NOTSET, 
18  
-                      file_obj=None):
19  
-    """Setup the root logger, console_level and file_level must be levels from the logging module"""
20  
-    # Set global level to 0 so we can catch anything with our handlers
21  
-    logging.getLogger().setLevel(0)
22  
-    
23  
-    if file_obj is not None:
24  
-        logging.basicConfig(level=file_level,
25  
-                            format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
26  
-                            datefmt='%m-%d %H:%M',
27  
-                            stream=file_obj)
28  
-    
29  
-    console = logging.StreamHandler()
30  
-    console.setLevel(console_level)
31  
-    formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
32  
-    console.setFormatter(formatter)
33  
-    
34  
-    logging.getLogger('').addHandler(console)
35  
-    return console
36  
-    
37  
-def setup_individual_logger(name, level=logging.NOTSET):
38  
-    
39  
-    logger = logging.getLogger(name)
40  
-    logger.setLevel(0)
41  
-    return logger
42  
-    
2  windmill/server/wsgi.py
@@ -16,7 +16,7 @@
16 16
 import httplib, os.path, copy, time, socket, logging, sys, traceback, random
17 17
 from StringIO import StringIO
18 18
 
19  
-import jsonrpc, logger
  19
+import jsonrpc
20 20
 import windmill
21 21
 
22 22
 import logging

0 notes on commit bc34566

Please sign in to comment.
Something went wrong with that request. Please try again.