Fixed ArrayIndexOutOfBoundsException and StringIndexOutOfBoundsException while logging