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

Remko Popma commented on LOG4J2-1385:
-------------------------------------

Levels is probably not a problem since the Strings are cached. You can avoid 
the boxing with the {{Unbox}} utililty. For example:
{code}
import static org.apache.logging.log4j.util.Unbox.box;
...
format.print(box(event.getNanoTime()), buffer, true);
...
{code}

Another important improvement is to let the Message write itself into the 
StringBuilder rather than calling {{event.getMessage().getFormattedMessage()}}. 
Would it be possible to create a CSVFormat  subclass in Log4j that knows about 
StringBuilderFormattable?

That way both CsvLogEventLayout and CsvParameterLayout can be made completely 
garbage-free (with the normal caveats for ThrownProxy, ContextMap and 
ContextStack).

> (GC) CSV layouts should not create a new CSVPrinter for each log event
> ----------------------------------------------------------------------
>
>                 Key: LOG4J2-1385
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1385
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>    Affects Versions: 2.5
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>             Fix For: 2.6.1
>
>         Attachments: logging-log4j2.patch
>
>
> CSV layouts should not create a new CSVPrinter for each log event. This will 
> likely require a new version of Apache Commons CVS, see [CSV-182].



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to