As discussed on the mailing list, we implemented logging with a single
root logger and logging configurations per entry points. The entry
points affected are:

 * Autotest client
 * Autoserv
 * Scheduler

We are sending patches for each one of those entry points. Now we don't
need to 'grab' loggers anymore to log messages, only need to use the
utility functions:

logging.info('msg')
logging.debug('msg')
logging.warning('msg')
logging.error('msg')
logging.critical('msg')

Which reduces complexity of the log system, and makes it easier for
developers to log messages, just select the level, make sure the
standard logging module is loaded, and profit!

From: Lucas Meneghel Rodrigues <lmr@linux.vnet.ibm.com>
Signed-off-by: Steve Howard <showard@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2915 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/drone_manager.py b/scheduler/drone_manager.py
index fe3b533..2f61117 100644
--- a/scheduler/drone_manager.py
+++ b/scheduler/drone_manager.py
@@ -1,5 +1,5 @@
 import os, re, shutil, signal, subprocess, errno, time, heapq, traceback
-import common
+import common, logging
 from autotest_lib.client.common_lib import error, global_config
 from autotest_lib.scheduler import email_manager, drone_utility, drones
 from autotest_lib.scheduler import scheduler_config
@@ -120,7 +120,7 @@
             except error.AutoservError:
                 warning = 'Drone %s failed to initialize:\n%s' % (
                     hostname, traceback.format_exc())
-                print warning
+                logging.warn(warning)
                 email_manager.manager.enqueue_notify_email(
                     'Drone failed to initialize', warning)
                 self._remove_drone(hostname)
@@ -131,7 +131,8 @@
 
         self.refresh_drone_configs()
 
-        print 'Using results repository on', results_repository_hostname
+        logging.info('Using results repository on %s', 
+                     results_repository_hostname)
         self._results_drone = drones.get_drone(results_repository_hostname)
         # don't initialize() the results drone - we don't want to clear out any
         # directories and we don't need ot kill any processes
@@ -147,7 +148,7 @@
 
 
     def _add_drone(self, hostname):
-        print 'Adding drone', hostname
+        logging.info('Adding drone %s' % hostname)
         drone = drones.get_drone(hostname)
         self._drones[drone.hostname] = drone
         return drone
@@ -315,7 +316,7 @@
         except error.AutoservError:
             warning = ('Results repository failed to execute calls:\n' +
                        traceback.format_exc())
-            print warning
+            logging.warn(warning)
             email_manager.manager.enqueue_notify_email(
                 'Results repository error', warning)
             self._results_drone.clear_call_queue()
@@ -342,7 +343,7 @@
         """
         Kill the given process.
         """
-        print 'killing', process
+        logging.info('killing %d' % process)
         drone = self._get_drone_for_process(process)
         drone.queue_call('kill_process', process)
 
@@ -433,8 +434,8 @@
         else:
             num_processes = self._extract_num_processes(command)
             drone = self._choose_drone_for_execution(num_processes)
-        print "command = %s" % command
-        print 'log file = %s:%s' % (drone.hostname, log_file)
+        logging.info("command = %s" % command)
+        logging.info('log file = %s:%s' % (drone.hostname, log_file))
         self._write_attached_files(command, drone)
         drone.queue_call('execute_command', command, working_directory,
                          log_file, pidfile_name)