Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

   def log_match(syslog=1)

      if syslog=1      

          x= syslog_config.log_config_values(syslog=1)

...

         return _log_match(syslog=0)

      elif x=3

         // how to check here?????? Recursion??

         _log_match(syslog=1)

         _log_match(syslog=0)

      else:

         _msg= "Log file to check not set"

         PtlLogMatchError(rc=1, rv=False, msg=_msg)        



  def _log_match(syslog=1)

     if   if syslog=1     

   // Setting an environment variable because whether to read from syslog file will be considered in other files too.        // Setting an environment variable will be easier than passing the value.Self.logutil=PBSLogUtils(syslog=1)

        os.environ["SYSLOG_VALUE"] = "1"        // Before returning value unset the environment variable self.init_logfile_path(syslog=1)

        del os.environ["SYSLOG_VALUE"] lines = self.log_lines(syslog=1)



  def init_logfile_path()     syslog_value = int(os.environ.get("SYSLOG_VALUE"))self, syslog=1)

     if syslog_value = 1

        path_log_file self.logfile = syslog_config.path_to_syslog()

     elif locally

        path_log_fileself.logfile = __local_path__

 

 

Note- 'def log_lines' returns the last n lines of the log file.

def log_lines()  syslog_value = int(os.environ.get("SYSLOG_VALUE")self, syslog=1)

  if syslog _value = 1

      path_log_file filename = syslog_config.path_to_syslog()

  elif locally

     path_log_filefilename = __local_path__




——————————In pbs_logutils.py—————————————

...

Change regular expression ‘tm_re ’ to match the date format of the syslog file.self.



syslog=0

tm_

...

re=_date_format_


Class PBSLogUtils(object)

    _init_(self, syslog):

         if self.syslog_value = 1

             syslog=0

             tm_re = syslog_config.time_syslog()

             fmt=format_of_date_time



     def convert_date_time(fmt)

...

         if syslog_value = 1

        

...

    fmt=    //get format from syslog_config.time_syslog()

         t = time.strptime(datetime, fmt)


Test Scenarios

1) Test that when PBS_SYSLOG=1 is enabled in pbs.conf, PBS logs messages via syslog.

...