You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2016/04/01 12:33:25 UTC

[jira] [Commented] (LOG4J2-1344) Update FileAppender to utilize gc-free Layout method

    [ https://issues.apache.org/jira/browse/LOG4J2-1344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15221518#comment-15221518 ] 

Remko Popma commented on LOG4J2-1344:
-------------------------------------

Note to self on how to approach this (draft):

FileManager
{code}
...
@Override
protected ByteBuffer createByteBuffer() {
    return bufferSize > 0 ? ByteBuffer.wrap(new byte[bufferSize]) : super.createByteBuffer();
}

...
// inner class
private static class FileManagerFactory implements ManagerFactory<FileManager, FactoryData> {
...
  public FileManager createManager(final String name, final FactoryData data) {
  ...
                // if Constants.ENABLE_THREADLOCALS is true,
                // we use ByteBufferDestination to buffer the data
                if (data.bufferedIO && !Constants.ENABLE_THREADLOCALS) {
                    os = new BufferedOutputStream(os, bufferSize);
                } else {
  ...
{code}

RollingFileManager
{code}
protected void createFileAfterRollover() throws IOException  {
    final OutputStream os = new FileOutputStream(getFileName(), isAppend());

    // if Constants.ENABLE_THREADLOCALS is true,
    // we use ByteBuffer to buffer the data.
    // Negative buffer size means no buffering.
    if (getBufferSize() > 0 && !Constants.ENABLE_THREADLOCALS) {
        setOutputStream(new BufferedOutputStream(os, getBufferSize()));
    } else {
        setOutputStream(os);
    }
}
{code}


> Update FileAppender to utilize gc-free Layout method
> ----------------------------------------------------
>
>                 Key: LOG4J2-1344
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1344
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 2.5
>            Reporter: Remko Popma
>
> TBD: would we want to include this in the upcoming 2.6 release?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org