Class YarnCentralTaskRollingLogAppender
- java.lang.Object
-
- org.apache.log4j.AppenderSkeleton
-
- com.mapr.log4j.MaprfsLogAppender
-
- com.mapr.log4j.CentralTaskLogAppender
-
- com.mapr.log4j.YarnCentralTaskLogAppender
-
- com.mapr.log4j.YarnCentralTaskRollingLogAppender
-
- All Implemented Interfaces:
java.io.Flushable,org.apache.hadoop.fs.Syncable,org.apache.log4j.Appender,org.apache.log4j.spi.OptionHandler
public class YarnCentralTaskRollingLogAppender extends YarnCentralTaskLogAppender
RollingLogAppender for YARN tasks. This code is copied from MaprfsRollingLogAppender. In order to make it work for Hadoop, we need to reuse the logic inYarnCentralTaskLogAppender#activateOptions. Since we cannot inherit from 2 classes, and the code is fairly small, we did not refactor.
-
-
Field Summary
Fields Modifier and Type Field Description protected intmaxBackupIndexThere is one backup file by default.protected longmaxFileSizeThe default maximum file size is 10MB.-
Fields inherited from class com.mapr.log4j.MaprfsLogAppender
BUFFER_SIZE, DIR_PREFIX, failoverAppender, failoverAppenderName, fileName, fileNamePath, immediateFlush, immediateSync, maprFS, nameHierarchy, syncIntervalSeconds, uri
-
-
Constructor Summary
Constructors Constructor Description YarnCentralTaskRollingLogAppender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(org.apache.log4j.spi.LoggingEvent event)protected java.lang.LonggetFileSizeLimit()This method is overridden to disable the max event based log file truncation in CentralTaskLogAppender.intgetMaxBackupIndex()Returns the value of the MaxBackupIndex option.longgetMaximumFileSize()Get the maximum size that the output file is allowed to reach before being rolled over to backup files.voidsetMaxBackupIndex(int maxBackups)Set the maximum number of backup files to keep around.voidsetMaxFileSize(java.lang.String value)Set the maximum size that the output file is allowed to reach before being rolled over to backup files.voidsetMaximumFileSize(long maxFileSize)Set the maximum size that the output file is allowed to reach before being rolled over to backup files.-
Methods inherited from class com.mapr.log4j.YarnCentralTaskLogAppender
getFrameworkType, getLogFilePermission
-
Methods inherited from class com.mapr.log4j.CentralTaskLogAppender
activateOptions, close, getIsCleanup, getTaskId, getTotalLogFileSize, setFile, setIsCleanup, setTaskId, setTotalLogFileSize
-
Methods inherited from class com.mapr.log4j.MaprfsLogAppender
closeFile, createFile, failoverToLocalLogs, flush, getFile, getFileSize, getImmediateFlush, getImmediateSync, getSyncIntervalSeconds, hflush, hsync, requiresLayout, setFailoverAppender, setFS, setImmediateFlush, setImmediateSync, setSyncIntervalSeconds, setURI, sync, writeFooter, writeHeader
-
-
-
-
Method Detail
-
getFileSizeLimit
protected java.lang.Long getFileSizeLimit()
This method is overridden to disable the max event based log file truncation in CentralTaskLogAppender. The file size limit is taken care by this rolling appender.- Overrides:
getFileSizeLimitin classYarnCentralTaskLogAppender
-
getMaxBackupIndex
public int getMaxBackupIndex()
Returns the value of the MaxBackupIndex option.
-
getMaximumFileSize
public long getMaximumFileSize()
Get the maximum size that the output file is allowed to reach before being rolled over to backup files.
-
setMaxBackupIndex
public void setMaxBackupIndex(int maxBackups)
Set the maximum number of backup files to keep around.The MaxBackupIndex option determines how many backup files are kept before the oldest is erased. This option takes a positive integer value. If set to zero, then there will be no backup files and the log file will be truncated when it reaches
MaxFileSize.
-
setMaximumFileSize
public void setMaximumFileSize(long maxFileSize)
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.This method is equivalent to
setMaxFileSize(java.lang.String)except that it is required for differentiating the setter taking alongargument from the setter taking aStringargument by the JavaBeansIntrospector.- See Also:
setMaxFileSize(String)
-
setMaxFileSize
public void setMaxFileSize(java.lang.String value)
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.In configuration files, the MaxFileSize option takes an long integer in the range 0 - 2^63. You can specify the value with the suffixes "KB", "MB" or "GB" so that the integer is interpreted being expressed respectively in kilobytes, megabytes or gigabytes. For example, the value "10KB" will be interpreted as 10240.
-
append
public void append(org.apache.log4j.spi.LoggingEvent event)
- Overrides:
appendin classCentralTaskLogAppender
-
-