Versions Compared

Key

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

...

Code Block
class LogEvent {
  /**
   * Logging event
   **/
  ILoggingEvent iLoggingEvent;
 
  /**
   * CDAP program entity-id
   **/
  EntityId entityId;
}

 

Step2: FileWriter

Currently we only have AvroFileWriter in Log.saver, we can create an interface for users to configure the FileWriter to provide if needed. This provides the option to abstract certain common logic for file rotation, get previous files , etc into an AbstractFileWriter and custom file writer can implement the other methods specific to it's logic, example : writing to HDFS as text filefiles, etc.

 

Code Block
public interface FileWriter {
 
  /**
   * append events to file
   **/
  void append(Iterator<ILoggingEvent> events)
 
  /**
   * rotate the old file corresponding to the entityId and timestamp and get a new file
   **/
  File rotateFile(File file, EntityId entityId, long timestamp)
 
  /**
   * if file already exists for this entity and timestamp base, then the file would be returned, else new file would be created
   **/
  File getFile(EntityId entityId, long timestamp)
 
  /**
   * close the file
   **/
  void close(File file, long timestamp)
 
  /**
   * close and delete the file
   **/
  void closeAndDelete(File file)
 
  /**
   * flush the contents
   **/
  void flush()
}

Code Block
public abstract class AbstractFileWriter implements FileWriter {
	
	public File rotateFile(File file, EntityId entityId, long timestamp) {
  		// common-logic for rotating files
	}
	public getFile(EntityId entityId, long timestamp) {
		// common-logic for getting previously files
	}
    // etc..
}

 

Option-1

Plugins Log Processor /File Writer Extensions run in the same container as log.saver. 

...

  • we can Stop the plugin (or) 
  • we can log an error and continue and stop the plugin after an error threshold.

4) stop the plugin log processor when log.saver stops.

 

Class-Loading Isolation

...

     Having isolation helps with plugins processor extensions to depend on different libraries, but should we allow them ? 

...