Ouch, scary! Would it be possible to reproduce this? I wonder why this is happening...
I updated TextEncoderHelper with a fallback mechanism to String.getBytes() in case an error occurs. That will also log the text that could not be encoded to the StatusLogger at ERROR level. If it happens again, can you post the text that causes the problem? Thanks! On Wed, Mar 23, 2016 at 2:25 AM, Gary Gregory <[email protected]> wrote: > Coincidentally, I just got: > > 2016-03-22 07:58:19,034 main ERROR An exception occurred processing > Appender RollingFile java.lang.IllegalArgumentException > at java.nio.Buffer.position(Buffer.java:236) > at sun.nio.cs.UTF_8.updatePositions(UTF_8.java:78) > at sun.nio.cs.UTF_8$Encoder.encodeArrayLoop(UTF_8.java:564) > at sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:619) > at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:561) > at > org.apache.logging.log4j.core.layout.TextEncoderHelper.encodeAsMuchAsPossible(TextEncoderHelper.java:93) > at > org.apache.logging.log4j.core.layout.TextEncoderHelper.encode(TextEncoderHelper.java:79) > at > org.apache.logging.log4j.core.layout.TextEncoderHelper.encodeText(TextEncoderHelper.java:66) > at > org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:185) > at > org.apache.logging.log4j.core.layout.AbstractLayout.encode(AbstractLayout.java:1) > at > org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender.append(RollingRandomAccessFileAppender.java:101) > at > org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:155) > at > org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128) > at > org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:119) > at > org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84) > at > org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:387) > at > org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:372) > at > org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:356) > at > org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:346) > at > org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63) > at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146) > at > org.apache.logging.log4j.spi.AbstractLogger.throwing(AbstractLogger.java:1263) > at > org.apache.logging.log4j.spi.AbstractLogger.throwing(AbstractLogger.java:1244) > at com.rs.jdbc.dv.DvLogger.throwingIOException(DvLogger.java:245) > > With a recent 2.6 SNAPSHOT. > > Gary > > On Tue, Mar 22, 2016 at 4:58 AM, Mikael Ståldal <[email protected] > > wrote: > >> I fixed it while moving the field and method to AbstractStringLayout (to >> be able to use from GelfLayout as well). >> >> On Tue, Mar 22, 2016 at 12:55 PM, Mikael Ståldal < >> [email protected]> wrote: >> >>> I am working on a fix. >>> >>> On Tue, Mar 22, 2016 at 11:52 AM, Remko Popma <[email protected]> >>> wrote: >>> >>>> I think you're right. This should be an instance field, not a static >>>> field. Good catch! >>>> >>>> >>>> On Tuesday, 22 March 2016, Mikael Ståldal <[email protected]> >>>> wrote: >>>> >>>>> In PatternLayout we have: >>>>> >>>>> private static final ThreadLocal<TextEncoderHelper> textEncoderHelper = >>>>> new ThreadLocal<>(); >>>>> >>>>> private TextEncoderHelper getCachedTextEncoderHelper() { >>>>> TextEncoderHelper result = textEncoderHelper.get(); >>>>> if (result == null) { >>>>> result = new TextEncoderHelper(getCharset()); >>>>> textEncoderHelper.set(result); >>>>> } >>>>> return result; >>>>> } >>>>> >>>>> >>>>> Does this really work properly? What if we have several instance of >>>>> PatternLayout with different charsets? >>>>> >>>>> -- >>>>> [image: MagineTV] >>>>> >>>>> *Mikael Ståldal* >>>>> Senior software developer >>>>> >>>>> *Magine TV* >>>>> [email protected] >>>>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >>>>> >>>>> Privileged and/or Confidential Information may be contained in this >>>>> message. If you are not the addressee indicated in this message >>>>> (or responsible for delivery of the message to such a person), you may >>>>> not copy or deliver this message to anyone. In such case, >>>>> you should destroy this message and kindly notify the sender by reply >>>>> email. >>>>> >>>> >>> >>> >>> -- >>> [image: MagineTV] >>> >>> *Mikael Ståldal* >>> Senior software developer >>> >>> *Magine TV* >>> [email protected] >>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >>> >>> Privileged and/or Confidential Information may be contained in this >>> message. If you are not the addressee indicated in this message >>> (or responsible for delivery of the message to such a person), you may >>> not copy or deliver this message to anyone. In such case, >>> you should destroy this message and kindly notify the sender by reply >>> email. >>> >> >> >> >> -- >> [image: MagineTV] >> >> *Mikael Ståldal* >> Senior software developer >> >> *Magine TV* >> [email protected] >> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >> >> Privileged and/or Confidential Information may be contained in this >> message. If you are not the addressee indicated in this message >> (or responsible for delivery of the message to such a person), you may >> not copy or deliver this message to anyone. In such case, >> you should destroy this message and kindly notify the sender by reply >> email. >> > > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory >
