Permalink
Browse files

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...
1 parent 48cbb84 commit bc34566eaa235d1390cb9c9bccf0dce94644302f @mikeal mikeal committed Jul 5, 2007
Showing with 15 additions and 46 deletions.
  1. +13 −2 windmill/bin/admin_lib.py
  2. +1 −1 windmill/server/__init__.py
  3. +0 −42 windmill/server/logger.py
  4. +1 −1 windmill/server/wsgi.py
View
@@ -72,7 +72,8 @@ def process_options(argv_list):
def setup_servers(console_level=logging.INFO):
"""Setup the server and return httpd and loggers"""
- console_handler = windmill.server.logger.setup_root_logger(console_level=console_level)
+ console_handler = logging.getLogger().handlers[0]
+ console_handler.setLevel(console_level)
httpd = windmill.server.wsgi.make_windmill_server()
return httpd, console_handler
@@ -89,6 +90,14 @@ def run_threaded(console_level=logging.INFO):
def configure_global_settings():
# Get local config
+
+ logging.getLogger().setLevel(0)
+
+ console = logging.StreamHandler()
+ console.setLevel(logging.INFO)
+ formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
+ console.setFormatter(formatter)
+ logging.getLogger().addHandler(console)
if os.environ.has_key('WINDMILL_CONFIG_FILE'):
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.expanduser(os.environ['WINDMILL_CONFIG_FILE']))))
@@ -142,8 +151,11 @@ def setup():
def teardown(shell_objects):
+
+ shell_objects['clear_queue']()
for controller in windmill.settings['controllers']:
+ controller.stop()
del(controller)
while shell_objects['httpd_thread'].isAlive():
@@ -168,7 +180,6 @@ def runserver_action(shell_objects):
teardown(shell_objects)
def shell_action(shell_objects):
-
# If ipython is installed and we weren't given the usecode option
try:
from IPython.Shell import IPShellEmbed
@@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import jsonrpc, logger, wsgi, convergence
+import jsonrpc, wsgi, convergence
View
@@ -1,42 +0,0 @@
-# Copyright (c) 2006-2007 Open Source Applications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import logging
-
-def setup_root_logger(console_level=logging.NOTSET, file_level=logging.NOTSET,
- file_obj=None):
- """Setup the root logger, console_level and file_level must be levels from the logging module"""
- # Set global level to 0 so we can catch anything with our handlers
- logging.getLogger().setLevel(0)
-
- if file_obj is not None:
- logging.basicConfig(level=file_level,
- format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
- datefmt='%m-%d %H:%M',
- stream=file_obj)
-
- console = logging.StreamHandler()
- console.setLevel(console_level)
- formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
- console.setFormatter(formatter)
-
- logging.getLogger('').addHandler(console)
- return console
-
-def setup_individual_logger(name, level=logging.NOTSET):
-
- logger = logging.getLogger(name)
- logger.setLevel(0)
- return logger
-
View
@@ -16,7 +16,7 @@
import httplib, os.path, copy, time, socket, logging, sys, traceback, random
from StringIO import StringIO
-import jsonrpc, logger
+import jsonrpc
import windmill
import logging

0 comments on commit bc34566

Please sign in to comment.