Hi all.
I recently moved from 1.2.14 to 1.3-alpha8 and began experiencing
StringIndexOutOfBounds
exceptions when logging.
I tracked the problem down to having multiple threads logging to two
appenders, and the
Two appenders sharing a common PatternLayout object. My code
initializes the
appenders thus:
...
...
PatternLayout pLayout = new PatternLayout("%d %-5p - %m%n");
FileAppender fAppender = new FileAppender(pLayout, "C:\\test.log");
ConsoleAppender cAppender = new ConsoleAppender(pLayout);
logger.addAppender(fAppender);
logger.addAppender(cAppender);
...
...
I solved the problem by creating a unique PatternLayout object for each
Appender.
I see there's a quite a bit of difference between the 1.2.X and 1.3.X
codebases. I think the
problem isn't manifest in 1.2.X because PatternConverter.format() is
calling StringBuffer.append()
on the formatting string, while in 1.3.X FormattingInfo.format() is
using StringBuffer.insert()
(although it could be (probably is) just a timing thing).
My question is: Will the bahavior of 1.3.X change in the future such
that I can use only
one PatternLayout for multiple appenders, or should I change my legacy
code to be more
defensive and allocate a PatternLayout for each Appender.
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]