Versions Compared

Key

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

...

Code Block
public interface FileWriterMultiFileWriter { 
  /**
   * get File manager for the log event. This file manager will be used to create, append-events, flush and close the file for the logging 
   * events to fileof entityId (logging-context)
   */
  void appendgetFileManager(Iterator<LogEvent>LogEvent eventsevent);
  

}
Code Block
interface FileManager {
  /**
   * createBased aon filethe corresponding to thelogEvent, get entityId and use that timestampinformation andto returncreate the file.
   **/
  File createFile(EntityId entityId, long timestamp);
 LogEvent logEvent); 

 /**
  * append log events to the currently active file belonging to the entityId represented by these log events. 
  * Logic : on the first append, we determine if the file has to be rotated or not using the RotationPolicy#shoudRotateFile(File file, LogEvent 
  * logEvent). If it has to be rotated, we will use RotationPolicy#rotateFile(File file, LogEvent logEvent) to rotate the file (close the old  
  * file) and append to the new file
  **/
  void appendEvents(Iterator<LogEvent> logEvents);  
 
  /**
   * close the currently active file.
   **/
  void close(File file, long timestamp);

  /**
   * flush the contents of the currently active file
   **/
  void flush();
}

 

 

Code Block
public interface RotationPolicy {
  /**
   * For the logEvent, decide if we should rotate the logcurrent file corresponding to this event or not.
   */
  boolean shouldRotateFile(File file, LogEvent logEvent);
 
  /**
   * For the logEvent, rotate the log file based on rotation logic and return the newly created File.
   */
  File rotateFile(File file, LogEvent logEvent);
 
  /**
   * For the logEvent, get the currently active file used for appending the log events.
   */ 		
  File getActiveFile(LogEvent logEvent);
}

 

Approach

...