Menu

#16 StringIndexOutOfBoundException with PatternLayout

open
5
2008-08-28
2008-08-28
No

PatternLayout= %-5p %c %m%n

LogFile:

DEBUG [xrac763] StringTools.string2Bytes()
K7G23Z5F
DEBUG [xrac763] StringTools.string2Bytes()

Exception: StringIndexOutOfBoundException

Problem: Log4jLogFileParser.pase(File) Line: 135
Code:
int index = line.indexOf( separationCharacter, currentIndex + padding - 1 );
String priorityString = line.substring( currentIndex, index );

separationCharacter=" " could not be fount and index=-1

Solution:

String priorityString = index != -1 ? line.substring( currentIndex, index ) : line;

Discussion

  • Wim Deblauwe

    Wim Deblauwe - 2008-08-28

    Logged In: YES
    user_id=172636
    Originator: NO

    Thank you for your thourough investigation, I'll look into it.

     
  • Wim Deblauwe

    Wim Deblauwe - 2008-08-28
    • assigned_to: nobody --> festerwim
     

Log in to post a comment.

MongoDB Logo MongoDB