예제 #1
0
    def shouldRollover(self, record):
        """
        Check the need to rotate.     
        """
        timed_rollover = TimedRotatingFileHandler.shouldRollover(self, record)
        sized_rollover = RotatingFileHandler.shouldRollover(self, record)

        return timed_rollover or sized_rollover
예제 #2
0
  def shouldRollover(self, record):
    if TimedRotatingFileHandler.shouldRollover(self, record):
      return 1

    msg = "%s\n" % self.format(record)

    if self.stream.tell() + len(msg) >= self.maxBytes:
      return 1

    return 0  
예제 #3
0
    def shouldRollover(self, record):
        if TimedRotatingFileHandler.shouldRollover(self, record):
            return 1

        msg = "%s\n" % self.format(record)

        if self.stream.tell() + len(msg) >= self.maxBytes:
            return 1

        return 0
예제 #4
0
 def _shouldRollover(self):
     """
     Determine whether a rollover should occur. This is an overwrite
     of the method used by ConcurrentRotatingFileHandler, in order to
     make it use time.
     """
     if(TimedRotatingFileHandler.shouldRollover(self, None)):
         return True
     else:
         self._degrade(False, "Rotation done or not needed at this time")
     return False
예제 #5
0
    def shouldRollover(self, record):
        """
        Determine if rollover should occur.

        Basically, see if TimedRotatingFileHandler.shouldRollover and if it's
        False see if the supplied record would cause the file to exceed
        the size limit we have.

        The size based rotation are from logging.handlers.RotatingFileHandler
        """
        if TimedRotatingFileHandler.shouldRollover(self, record):
            return 1
        else:
            # check the size
            if self.stream is None:                 # delay was set...
                self.stream = self._open()
            if self.maxBytes > 0:                   # are we rolling over?
                msg = "%s\n" % self.format(record)
                self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
                if self.stream.tell() + len(msg) >= self.maxBytes:
                    return 1
            return 0
예제 #6
0
 def shouldRollover(self, record):
     return TimedRotatingFileHandler.shouldRollover(
         self, record) or RotatingFileHandler.shouldRollover(self, record)
예제 #7
0
 def shouldRollover(self, record):
     return bool(TimedRotatingFileHandler.shouldRollover(self, record)) or \
            bool(RotatingFileHandler.shouldRollover(self, record))
예제 #8
0
 def shouldRollover(self, record):
     """ Determine if rollover should occur. """
     return (TimedRotatingFileHandler.shouldRollover(self, record)
             or RotatingFileHandler.shouldRollover(self, record))
예제 #9
0
 def shouldRollover(self, record):
     """
     description : determines when to roll over (overloading)
     """
     return TimedRotatingFileHandler.shouldRollover(self, record) \
             or RotatingFileHandler.shouldRollover(self, record)
예제 #10
0
파일: pnm_v2.py 프로젝트: PMacHarrie/NPG-BK
    # Main loop

    i = 0

    #print "loop through priorities"

    #       print "jb=", json.dumps(jb, indent=2)
    #       for x in sorted(jb["jobPriority"]):
    #               print "priority", x, jb["jobPriority"][x]

    #       exit(1)

    while (True):

        if (rfh.shouldRollover(rfh)):
            logit('Log Roll Over!')
            LOG = open(rfh.baseFilename, 'a')
    # If a job box is free, and there is a job to run, get it and run it.

        if jb['free'] > 0:
            jobId = getJob()
            if jobId > 0:
                myjb = getJobBox(jobId)
                #logit("Assigned Job:" + str(jobId))
                #print "jb=", jb
                jobIdStr = str(jobId)
                jb[myjb]['p'] = mp.Process(target=runProductionJob,
                                           args=(jobId, ))
                #print "called Process"
                jb[myjb]['p'].start()