You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by yh...@apache.org on 2008/09/10 07:03:30 UTC

svn commit: r693705 - in /hadoop/core/trunk/src/contrib/hod: CHANGES.txt bin/hod hodlib/Common/logger.py hodlib/Hod/hod.py

Author: yhemanth
Date: Tue Sep  9 22:03:29 2008
New Revision: 693705

URL: http://svn.apache.org/viewvc?rev=693705&view=rev
Log:
HADOOP-4060. Modified HOD to rotate log files on the client side. Contributed by Vinod Kumar Vavilapalli.

Modified:
    hadoop/core/trunk/src/contrib/hod/CHANGES.txt
    hadoop/core/trunk/src/contrib/hod/bin/hod
    hadoop/core/trunk/src/contrib/hod/hodlib/Common/logger.py
    hadoop/core/trunk/src/contrib/hod/hodlib/Hod/hod.py

Modified: hadoop/core/trunk/src/contrib/hod/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/CHANGES.txt?rev=693705&r1=693704&r2=693705&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/CHANGES.txt (original)
+++ hadoop/core/trunk/src/contrib/hod/CHANGES.txt Tue Sep  9 22:03:29 2008
@@ -15,7 +15,14 @@
 
   BUG FIXES
 
-Release 0.18.0 - Unreleased
+Release 0.18.1 - Unreleased
+
+  INCOMPATIBLE CHANGES
+
+    HADOOP-4060. Modified HOD to rotate log files on the client side.
+    (Vinod Kumar Vavilapalli via yhemanth)
+
+Release 0.18.0 - 2008-08-19
 
   INCOMPATIBLE CHANGES
 

Modified: hadoop/core/trunk/src/contrib/hod/bin/hod
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/bin/hod?rev=693705&r1=693704&r2=693705&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/bin/hod (original)
+++ hadoop/core/trunk/src/contrib/hod/bin/hod Tue Sep  9 22:03:29 2008
@@ -156,7 +156,10 @@
               True, None, False, True, 'l'),
 
              ('script-wait-time', 'pos_int', 'Specifies the time to wait before running the script. Used with the hod.script option.',
-              True, 10, False, True, 'W')),
+              True, 10, False, True, 'W'),
+
+             ('log-rollover-count', 'pos_int', 'Specifies the number of rolled-over log files of HOD client. A zero value disables rollover.',
+              True, 5, False, True, 'L')),
 
             'resource_manager' : (
              ('id', 'string', 'Batch scheduler ID: torque|condor.',

Modified: hadoop/core/trunk/src/contrib/hod/hodlib/Common/logger.py
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/hodlib/Common/logger.py?rev=693705&r1=693704&r2=693705&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/hodlib/Common/logger.py (original)
+++ hadoop/core/trunk/src/contrib/hod/hodlib/Common/logger.py Tue Sep  9 22:03:29 2008
@@ -310,12 +310,18 @@
                 logFile = os.path.join(logDirectory, "%s-%s.log" % (
                     self.__appName, loggerName))
 
+                logFilePresent = False
+                if(os.path.exists(logFile)):
+                  logFilePresent = True
+
                 if sys.version.startswith('2.4'):
                     fileHandler = hodRotatingFileHandler(logFile,
                         maxBytes=maxBytes, backupCount=backupCount)
                 else:
                     fileHandler = logging.handlers.RotatingFileHandler(logFile,
                         maxBytes=maxBytes, backupCount=backupCount)
+                if logFilePresent and backupCount:
+                  fileHandler.doRollover()
 
                 fileHandler.setLevel(loggingLevel)
                 fileHandler.setFormatter(fileFormater)

Modified: hadoop/core/trunk/src/contrib/hod/hodlib/Hod/hod.py
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/hodlib/Hod/hod.py?rev=693705&r1=693704&r2=693705&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/hodlib/Hod/hod.py (original)
+++ hadoop/core/trunk/src/contrib/hod/hodlib/Hod/hod.py Tue Sep  9 22:03:29 2008
@@ -169,8 +169,9 @@
     return self.__log
 
   def __setup_cluster_logger(self, directory):
-    self.__baseLogger.add_file(logDirectory=directory, level=4, 
-                               addToLoggerNames=(self.__user ,))
+    self.__baseLogger.add_file(logDirectory=directory, level=4,
+                          backupCount=self.__cfg['hod']['log-rollover-count'],
+                          addToLoggerNames=(self.__user ,))
 
   def __setup_cluster_state(self, directory):
     self.__clusterState = hodState(directory)