logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Wieczorek (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-295) BufferOverflowException in FastFileManager when logging huge messages
Date Thu, 04 Jul 2013 14:19:48 GMT

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

Tom Wieczorek commented on LOG4J2-295:
--------------------------------------

2.0-beta8-SNAPSHOT built from r1498254 works for me. Thanks for fixing!
                
> BufferOverflowException in FastFileManager when logging huge messages
> ---------------------------------------------------------------------
>
>                 Key: LOG4J2-295
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-295
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0-beta7
>            Reporter: Tom Wieczorek
>            Assignee: Remko Popma
>             Fix For: 2.0-beta8
>
>
> When logging messages larger than {{FastFileManager.DEFAULT_BUFFER_SIZE}} with appenders
using {{FastFileManager}}, the logging fails internally with a {{BufferOverflowException}}
and no log output is produced by these appenders.
> ----
> *Test case*
> {noformat}
> import java.util.Arrays;
> import org.apache.logging.log4j.LogManager;
> public class TestBufferOverflow {
>   public static void main(String[] args) {
>     final String longMessage;
>     {
>       char[] chars = new char[384 * 1024];
>       Arrays.fill(chars, 'x');
>       longMessage = new String(chars);
>     }
>     LogManager.getLogger("TestBufferOverflow").info(longMessage);
>   }
> }
> {noformat}
> ----
> *log4j2.xml*
> {noformat}
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration>
>   <appenders>
>     <FastFile name="file" fileName="test.log" suppressExceptions="false">
>       <PatternLayout>
>         <pattern>%m%n</pattern>
>       </PatternLayout>
>     </FastFile>
>   </appenders>
>   <loggers>
>     <root level="info">
>       <appender-ref ref="file" />
>     </root>
>   </loggers>
> </configuration>
> {noformat}
> ----
> *Exception thrown*
> {noformat}
> Exception in thread "main" org.apache.logging.log4j.core.appender.AppenderRuntimeException:
An exception occurred processing Appender file
> 	at org.apache.logging.log4j.core.appender.DefaultErrorHandler.error(DefaultErrorHandler.java:73)
> 	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:104)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:424)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:405)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:366)
> 	at org.apache.logging.log4j.core.Logger.log(Logger.java:110)
> 	at org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1010)
> 	at TestBufferOverflow.main(TestBufferOverflow.java:16)
> Caused by: java.nio.BufferOverflowException
> 	at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:165)
> 	at org.apache.logging.log4j.core.appender.FastFileManager.write(FastFileManager.java:89)
> 	at org.apache.logging.log4j.core.appender.OutputStreamManager.write(OutputStreamManager.java:129)
> 	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:113)
> 	at org.apache.logging.log4j.core.appender.FastFileAppender.append(FastFileAppender.java:84)
> 	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:102)
> 	... 6 more
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message