HuanjieGuo commented on PR #41064:
URL: https://github.com/apache/airflow/pull/41064#issuecomment-2254328669

   > Are you sure this change is going to be backwards compatible?
   
   @potiuk 
   
   the new added parameters all have default value, should not break the 
existed init process for **FileTaskHandler**
   
   About the running logic: 
   
   NonCachingRotatingFileHandler -> RotatingFileHandler -> BaseRotatingHandler 
-> FileHandler
   
   NonCachingFileHandler -> FileHandler
   
   In the **BaseRotatingHandler**
   
   ```
       def emit(self, record):
           """
           Emit a record.
   
           Output the record to the file, catering for rollover as described
           in doRollover().
           """
           try:
               if self.shouldRollover(record):
                   self.doRollover()
               logging.FileHandler.emit(self, record)
           except Exception:
               self.handleError(record)
   ```
   
   In the **RotatingFileHandler**
   
   ```
       def shouldRollover(self, record):
           """
           Determine if rollover should occur.
   
           Basically, see if the supplied record would cause the file to exceed
           the size limit we have.
           """
           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
   ```
   
   since the default maxBytes for this change is set to 0, so the call to the 
BaseRotatingHandler.emit() will directly call the   
logging.FileHandler.emit(self, record).
   
   It should be the same as we directly call the NonCachingFileHandler.emit() 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to