org.apache.logging.log4j.core.appender.rolling
Class RollingFileManager

java.lang.Object
  extended by org.apache.logging.log4j.core.appender.AbstractManager
      extended by org.apache.logging.log4j.core.appender.OutputStreamManager
          extended by org.apache.logging.log4j.core.appender.FileManager
              extended by org.apache.logging.log4j.core.appender.rolling.RollingFileManager
Direct Known Subclasses:
RollingRandomAccessFileManager

public class RollingFileManager
extends FileManager

The Rolling File Manager.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.appender.OutputStreamManager
layout
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractManager
count, LOGGER
 
Constructor Summary
protected RollingFileManager(String fileName, String pattern, OutputStream os, boolean append, long size, long time, TriggeringPolicy triggeringPolicy, RolloverStrategy rolloverStrategy, String advertiseURI, Layout<? extends Serializable> layout, int bufferSize)
           
 
Method Summary
 void checkRollover(LogEvent event)
          Determine if a rollover should occur.
protected  void createFileAfterRollover()
           
static RollingFileManager getFileManager(String fileName, String pattern, boolean append, boolean bufferedIO, TriggeringPolicy policy, RolloverStrategy strategy, String advertiseURI, Layout<? extends Serializable> layout, int bufferSize)
          Returns a RollingFileManager.
 long getFileSize()
          Returns the current size of the file.
 long getFileTime()
          Returns the time the file was created.
 PatternProcessor getPatternProcessor()
          Returns the pattern processor.
 RolloverStrategy getRolloverStrategy()
          Returns the rollover strategy
 TriggeringPolicy getTriggeringPolicy()
          Returns the triggering policy
protected  void write(byte[] bytes, int offset, int length)
          Some output streams synchronize writes while others do not.
 
Methods inherited from class org.apache.logging.log4j.core.appender.FileManager
getBufferSize, getContentFormat, getFileManager, getFileName, isAppend, isLocking
 
Methods inherited from class org.apache.logging.log4j.core.appender.OutputStreamManager
close, flush, getManager, getOutputStream, isOpen, releaseSub, setOutputStream, write, writeFooter
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractManager
getCount, getName, hasManager, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RollingFileManager

protected RollingFileManager(String fileName,
                             String pattern,
                             OutputStream os,
                             boolean append,
                             long size,
                             long time,
                             TriggeringPolicy triggeringPolicy,
                             RolloverStrategy rolloverStrategy,
                             String advertiseURI,
                             Layout<? extends Serializable> layout,
                             int bufferSize)
Method Detail

getFileManager

public static RollingFileManager getFileManager(String fileName,
                                                String pattern,
                                                boolean append,
                                                boolean bufferedIO,
                                                TriggeringPolicy policy,
                                                RolloverStrategy strategy,
                                                String advertiseURI,
                                                Layout<? extends Serializable> layout,
                                                int bufferSize)
Returns a RollingFileManager.

Parameters:
fileName - The file name.
pattern - The pattern for rolling file.
append - true if the file should be appended to.
bufferedIO - true if data should be buffered.
policy - The TriggeringPolicy.
strategy - The RolloverStrategy.
advertiseURI - the URI to use when advertising the file
layout - The Layout.
bufferSize - buffer size to use if bufferedIO is true
Returns:
A RollingFileManager.

write

protected void write(byte[] bytes,
                     int offset,
                     int length)
Description copied from class: OutputStreamManager
Some output streams synchronize writes while others do not. Synchronizing here insures that log events won't be intertwined.

Overrides:
write in class FileManager
Parameters:
bytes - The serialized Log event.
offset - The offset into the byte array.
length - The number of bytes to write.

getFileSize

public long getFileSize()
Returns the current size of the file.

Returns:
The size of the file in bytes.

getFileTime

public long getFileTime()
Returns the time the file was created.

Returns:
The time the file was created.

checkRollover

public void checkRollover(LogEvent event)
Determine if a rollover should occur.

Parameters:
event - The LogEvent.

createFileAfterRollover

protected void createFileAfterRollover()
                                throws IOException
Throws:
IOException

getPatternProcessor

public PatternProcessor getPatternProcessor()
Returns the pattern processor.

Returns:
The PatternProcessor.

getTriggeringPolicy

public TriggeringPolicy getTriggeringPolicy()
Returns the triggering policy

Returns:
The TriggeringPolicy

getRolloverStrategy

public RolloverStrategy getRolloverStrategy()
Returns the rollover strategy

Returns:
The RolloverStrategy


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.