Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.logging.log4j.core.appender
Class FileManager

    java.lang.Object
      org.apache.logging.log4j.core.appender.AbstractManager
          org.apache.logging.log4j.core.appender.OutputStreamManager
              org.apache.logging.log4j.core.appender.FileManager

Direct Known Subclasses:
  RollingFileManager

    public class FileManager

extends OutputStreamManager

Manages actual File I/O for File Appenders.

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` | `FileManager(String fileName, OutputStream os, boolean append, boolean locking, String advertiseURI, Layout<? extends Serializable> layout, int bufferSize)`

Method Summary
`int` | `getBufferSize()` Returns the buffer size to use if the appender was configured with BufferedIO=true, otherwise returns a negative number.
`Map<String,String>` | `getContentFormat()` FileManager's content format is specified by: `Key: "fileURI" Value: provided "advertiseURI" param`.
`static FileManager` | `getFileManager(String fileName, boolean append, boolean locking, boolean bufferedIo, String advertiseUri, Layout<? extends Serializable> layout, int bufferSize)` Returns the FileManager.
`String` | `getFileName()` Returns the name of the File being managed.
`boolean` | `isAppend()` Returns the append status.
`boolean` | `isLocking()` Returns the lock status.
`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.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

### FileManager

    protected FileManager(String fileName,
                          OutputStream os,
                          boolean append,
                          boolean locking,
                          String advertiseURI,
                          Layout<? extends Serializable> layout,
                          int bufferSize)

Method Detail

### getFileManager

    public static FileManager getFileManager(String fileName,
                                             boolean append,
                                             boolean locking,
                                             boolean bufferedIo,
                                             String advertiseUri,
                                             Layout<? extends Serializable> layout,
                                             int bufferSize)

  Returns the FileManager.

  Parameters:
    `fileName` - The name of the file to manage.
    `append` - true if the file should be appended to, false if it should be overwritten.
    `locking` - true if the file should be locked while writing, false otherwise.
    `bufferedIo` - true if the contents should be buffered as they are written.
    `advertiseUri` - the URI to use when advertising the file
    `layout` - The layout
    `bufferSize` - buffer size for buffered IO
  Returns:
    A FileManager for the File.

### 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 `OutputStreamManager`
  Parameters:
    `bytes` - The serialized Log event.
    `offset` - The offset into the byte array.
    `length` - The number of bytes to write.

### getFileName

    public String getFileName()

  Returns the name of the File being managed.

  Returns:
    The name of the File being managed.

### isAppend

    public boolean isAppend()

  Returns the append status.

  Returns:
    true if the file will be appended to, false if it is overwritten.

### isLocking

    public boolean isLocking()

  Returns the lock status.

  Returns:
    true if the file will be locked when writing, false otherwise.

### getBufferSize

    public int getBufferSize()

  Returns the buffer size to use if the appender was configured with BufferedIO=true, otherwise returns a negative number.

  Returns:
    the buffer size, or a negative number if the output stream is not buffered

### getContentFormat

    public Map<String,String> getContentFormat()

  FileManager's content format is specified by: `Key: "fileURI" Value: provided "advertiseURI" param`.

  Overrides:
    `getContentFormat` in class `AbstractManager`
  Returns:
    Map of content format keys supporting FileManager

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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.