[jira] [Commented] (LOG4J2-1348) Add an AutoCloseable ThreadContext class: CloseableThreadContext
[ https://issues.apache.org/jira/browse/LOG4J2-1348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15234183#comment-15234183 ] Greg Thomas commented on LOG4J2-1348: - Yup, totally agree with you over the bad naming- I couldn't come up with anything better. Another alternative; {{withValue}}/{{withPair}} but I'm fairly unattached to them all. Unless someone comes up with a strong preference / better idea, I'll rename to the {{withPush}} / {{withPut}} later.. > Add an AutoCloseable ThreadContext class: CloseableThreadContext > > > Key: LOG4J2-1348 > URL: https://issues.apache.org/jira/browse/LOG4J2-1348 > Project: Log4j 2 > Issue Type: Improvement > Components: API >Reporter: Greg Thomas >Assignee: Gary Gregory >Priority: Minor > Fix For: 2.6 > > Attachments: CloseableThreadContext.zip, ctc.patch, > thread-context.xml.patch > > > The log4j2 API provides a ThreadContext - > https://logging.apache.org/log4j/2.x/manual/thread-context.html - that > allows items to be added to a stack or a map for logging, and then > subsequently removed once they are no longer required. > This sounds like an ideal candidate for a AutoCloseable implementation so > that items are removed automatically and no longer left around littering the > stack/map. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Reopened] (LOG4J2-1348) Add an AutoCloseable ThreadContext class: CloseableThreadContext
[ https://issues.apache.org/jira/browse/LOG4J2-1348?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Greg Thomas reopened LOG4J2-1348: - Re-opening to attached patch > Add an AutoCloseable ThreadContext class: CloseableThreadContext > > > Key: LOG4J2-1348 > URL: https://issues.apache.org/jira/browse/LOG4J2-1348 > Project: Log4j 2 > Issue Type: Improvement > Components: API >Reporter: Greg Thomas >Assignee: Gary Gregory >Priority: Minor > Fix For: 2.6 > > Attachments: CloseableThreadContext.zip, thread-context.xml.patch > > > The log4j2 API provides a ThreadContext - > https://logging.apache.org/log4j/2.x/manual/thread-context.html - that > allows items to be added to a stack or a map for logging, and then > subsequently removed once they are no longer required. > This sounds like an ideal candidate for a AutoCloseable implementation so > that items are removed automatically and no longer left around littering the > stack/map. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Closed] (LOG4J2-1329) API change: let Message.getFormattedMessage() return CharSequence instead of String
[ https://issues.apache.org/jira/browse/LOG4J2-1329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Remko Popma closed LOG4J2-1329. --- > API change: let Message.getFormattedMessage() return CharSequence instead of > String > --- > > Key: LOG4J2-1329 > URL: https://issues.apache.org/jira/browse/LOG4J2-1329 > Project: Log4j 2 > Issue Type: Improvement > Components: API >Affects Versions: 2.5 >Reporter: Remko Popma > > I propose that we change {{Message.getFormattedMessage()}} to return a > {{CharSequence}} instead of a String. > I believe this change would be backwards compatible (all Message > implementations that return a String will work as is), and it opens the way > for zero-GC Message implementations to return a cached StringBuilder as > Mikael [suggested on the log4j-dev mailing > list|http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/201603.mbox/%3CCAAFrFhSs4EqjOERwHObKAZP4wjGWeiCET1nyE1FVndYdePk2yw%40mail.gmail.com%3E]. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Closed] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mikael Ståldal closed LOG4J2-1356. -- > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1329) API change: let Message.getFormattedMessage() return CharSequence instead of String
[ https://issues.apache.org/jira/browse/LOG4J2-1329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15234066#comment-15234066 ] Remko Popma commented on LOG4J2-1329: - Are we okay to close this issue? > API change: let Message.getFormattedMessage() return CharSequence instead of > String > --- > > Key: LOG4J2-1329 > URL: https://issues.apache.org/jira/browse/LOG4J2-1329 > Project: Log4j 2 > Issue Type: Improvement > Components: API >Affects Versions: 2.5 >Reporter: Remko Popma > > I propose that we change {{Message.getFormattedMessage()}} to return a > {{CharSequence}} instead of a String. > I believe this change would be backwards compatible (all Message > implementations that return a String will work as is), and it opens the way > for zero-GC Message implementations to return a cached StringBuilder as > Mikael [suggested on the log4j-dev mailing > list|http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/201603.mbox/%3CCAAFrFhSs4EqjOERwHObKAZP4wjGWeiCET1nyE1FVndYdePk2yw%40mail.gmail.com%3E]. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15234064#comment-15234064 ] Remko Popma commented on LOG4J2-1356: - Thanks! Looks like I missed that when I removed the ThreadLocal from AbstractStringLayout. Removed the check in PatternLayout now. > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Comment Edited] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15234021#comment-15234021 ] Mikael Ståldal edited comment on LOG4J2-1356 at 4/10/16 9:43 AM: - Yes: {code} @Override public void encode(final LogEvent event, final ByteBufferDestination destination) { if (!Constants.ENABLE_THREADLOCALS || !(eventSerializer instanceof Serializer2)) { super.encode(event, destination); return; } final StringBuilder text = toText((Serializer2) eventSerializer, event, getStringBuilder()); final TextEncoderHelper helper = getCachedTextEncoderHelper(); helper.encodeText(text, destination); } {code} was (Author: mikaelstaldal): Yes: {code|PatternLayout.java} @Override public void encode(final LogEvent event, final ByteBufferDestination destination) { if (!Constants.ENABLE_THREADLOCALS || !(eventSerializer instanceof Serializer2)) { super.encode(event, destination); return; } final StringBuilder text = toText((Serializer2) eventSerializer, event, getStringBuilder()); final TextEncoderHelper helper = getCachedTextEncoderHelper(); helper.encodeText(text, destination); } {code} > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15234019#comment-15234019 ] Mikael Ståldal commented on LOG4J2-1356: GelfLayout is just a Layout, not connected to any specific Appender. > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15234010#comment-15234010 ] Remko Popma commented on LOG4J2-1356: - Agree no need to check Constants.ENABLE_THREADLOCALS if ThreadLocals aren't used. Is this Constant still checked in PatternLayout? > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15234001#comment-15234001 ] Mikael Ståldal commented on LOG4J2-1356: Maybe not even need to check for Constants.ENABLE_THREADLOCALS, since GlefLayout does not use any ThreadLocals with non-JDK classes? And maybe the same method in PatternLayout doesn't need to check for Constants.ENABLE_THREADLOCALS either? > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Comment Edited] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15233999#comment-15233999 ] Mikael Ståldal edited comment on LOG4J2-1356 at 4/10/16 8:55 AM: - So then I don't need to check for Constants.ENABLE_DIRECT_ENCODERS in GelfLayout like this? {code} @Override public void encode(final LogEvent event, final ByteBufferDestination destination) { if (!Constants.ENABLE_DIRECT_ENCODERS || !Constants.ENABLE_THREADLOCALS || compressionType != CompressionType.OFF) { super.encode(event, destination); return; } final StringBuilder text = toText(event, getStringBuilder(), true); final TextEncoderHelper helper = getCachedTextEncoderHelper(); helper.encodeText(text, destination); } {code} was (Author: mikaelstaldal): So then I don't need to check for Constants.ENABLE_DIRECT_ENCODERS in GelfLayout like this? @Override public void encode(final LogEvent event, final ByteBufferDestination destination) { if (!Constants.ENABLE_DIRECT_ENCODERS || !Constants.ENABLE_THREADLOCALS || compressionType != CompressionType.OFF) { super.encode(event, destination); return; } final StringBuilder text = toText(event, getStringBuilder(), true); final TextEncoderHelper helper = getCachedTextEncoderHelper(); helper.encodeText(text, destination); } > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15233999#comment-15233999 ] Mikael Ståldal commented on LOG4J2-1356: So then I don't need to check for Constants.ENABLE_DIRECT_ENCODERS in GelfLayout like this? @Override public void encode(final LogEvent event, final ByteBufferDestination destination) { if (!Constants.ENABLE_DIRECT_ENCODERS || !Constants.ENABLE_THREADLOCALS || compressionType != CompressionType.OFF) { super.encode(event, destination); return; } final StringBuilder text = toText(event, getStringBuilder(), true); final TextEncoderHelper helper = getCachedTextEncoderHelper(); helper.encodeText(text, destination); } > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Comment Edited] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15233993#comment-15233993 ] Remko Popma edited comment on LOG4J2-1356 at 4/10/16 8:44 AM: -- Sorry I was unclear. Layouts should provide both mechanisms: {{encode(...)}} and {{toSerializable()}}. PatterLayout does this and is okay as is. Appenders should control which mechanism is used based on the value of Constants.ENABLE_DIRECT_ENCODERS. See AbstractOutputStreamAppender.addEvent for what I mean. was (Author: rem...@yahoo.com): Sorry I was unclear. Layouts should provide both mechanisms: {{encode(...)}} and {{toSerializable()}}. Appenders should control which mechanism is used based on the value of Constants.ENABLE_DIRECT_ENCODERS. > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15233993#comment-15233993 ] Remko Popma commented on LOG4J2-1356: - Sorry I was unclear. Layouts should provide both mechanisms: {{encode(...)}} and {{toSerializable()}}. Appenders should control which mechanism is used based on the value of Constants.ENABLE_DIRECT_ENCODERS. > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Resolved] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mikael Ståldal resolved LOG4J2-1356. Resolution: Fixed Fixed in master branch > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1356) Update GelfLayout to utilize gc-free mechanism for LogEvent processing
[ https://issues.apache.org/jira/browse/LOG4J2-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15233986#comment-15233986 ] Mikael Ståldal commented on LOG4J2-1356: OK, added usage of Constants.ENABLE_DIRECT_ENCODERS in GelfLayout. Shouldn't PatternLayout use it as well? > Update GelfLayout to utilize gc-free mechanism for LogEvent processing > --- > > Key: LOG4J2-1356 > URL: https://issues.apache.org/jira/browse/LOG4J2-1356 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts >Affects Versions: 2.5 >Reporter: Mikael Ståldal >Assignee: Mikael Ståldal > Labels: gc, performance > > GelfLayout should support gc-free logging when used with compressionType=OFF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org