Re: Log4j2's SimpleLogger Implementation Issue for var args method's
Yogesh, Thank you for you message. We can only take code submissions via unified diff files attached to JIRA. I think we might also be able to (legally) accept Git pull requests but I am not 100% sure on that one. When providing a patch it would be most helpful to do so against the Git master branch. In any case, please create JIRA issue. Thank you, Gary On Tue, Sep 2, 2014 at 10:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 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
Re: Log4j2's SimpleLogger Implementation Issue for var args method's
Hi Gary, I haven't worked on Git as yet, I think i will provide a diff of the files (with Git Master branch) and attach it to JIRA . Alternatively if there any link for creating and submitting Git patches, please do let me know I can provide that as well. Regards, -Yogesh On Tue, Sep 2, 2014 at 8:05 PM, Gary Gregory garydgreg...@gmail.com wrote: Yogesh, Thank you for you message. We can only take code submissions via unified diff files attached to JIRA. I think we might also be able to (legally) accept Git pull requests but I am not 100% sure on that one. When providing a patch it would be most helpful to do so against the Git master branch. In any case, please create JIRA issue. Thank you, Gary On Tue, Sep 2, 2014 at 10:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 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
Re: Log4j2's SimpleLogger Implementation Issue for var args method's
The easiest path will be for you to let an IDE (like Eclipse, my favorite) generate a patch for you from the Team-Create Patch... dialog. Depending on your Eclipse set up you might have to install EGit to get git support in Eclipse. Gary On Tue, Sep 2, 2014 at 10:53 AM, Yogesh Rao yog...@gmail.com wrote: Hi Gary, I haven't worked on Git as yet, I think i will provide a diff of the files (with Git Master branch) and attach it to JIRA . Alternatively if there any link for creating and submitting Git patches, please do let me know I can provide that as well. Regards, -Yogesh On Tue, Sep 2, 2014 at 8:05 PM, Gary Gregory garydgreg...@gmail.com wrote: Yogesh, Thank you for you message. We can only take code submissions via unified diff files attached to JIRA. I think we might also be able to (legally) accept Git pull requests but I am not 100% sure on that one. When providing a patch it would be most helpful to do so against the Git master branch. In any case, please create JIRA issue. Thank you, Gary On Tue, Sep 2, 2014 at 10:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 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 -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 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
Re: Log4j2's SimpleLogger Implementation Issue for var args method's
Create Patch would be way for me then :-) and will get the plugin support for eclipse Regards, -Yogesh On Tue, Sep 2, 2014 at 8:26 PM, Gary Gregory garydgreg...@gmail.com wrote: The easiest path will be for you to let an IDE (like Eclipse, my favorite) generate a patch for you from the Team-Create Patch... dialog. Depending on your Eclipse set up you might have to install EGit to get git support in Eclipse. Gary On Tue, Sep 2, 2014 at 10:53 AM, Yogesh Rao yog...@gmail.com wrote: Hi Gary, I haven't worked on Git as yet, I think i will provide a diff of the files (with Git Master branch) and attach it to JIRA . Alternatively if there any link for creating and submitting Git patches, please do let me know I can provide that as well. Regards, -Yogesh On Tue, Sep 2, 2014 at 8:05 PM, Gary Gregory garydgreg...@gmail.com wrote: Yogesh, Thank you for you message. We can only take code submissions via unified diff files attached to JIRA. I think we might also be able to (legally) accept Git pull requests but I am not 100% sure on that one. When providing a patch it would be most helpful to do so against the Git master branch. In any case, please create JIRA issue. Thank you, Gary On Tue, Sep 2, 2014 at 10:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 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 -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 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
Re: Log4j2's SimpleLogger Implementation Issue for var args method's
What will you do instead of throwing an ArrayIndexOutOfBoundsException? This is obviously a user error. It would be misleading (but maybe acceptable) to substitute “null” for the placeholders, but just throwing a different exception probably isn’t worth the trouble. Ralph On Sep 2, 2014, at 7:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Log4j2's SimpleLogger Implementation Issue for var args method's
Hi Ralph, IMO new Object[0] as a param value is valid and should behave similar to a call to the method without param i.e. logger.error(Hello World {} in {} ); In the above context adding a conditional check params.length 0 with then the if @ line 157 wouldn't end up throwing the error and print the given message Regards, -Yogesh On Tue, Sep 2, 2014 at 9:45 PM, Ralph Goers ralph.go...@dslextreme.com wrote: What will you do instead of throwing an ArrayIndexOutOfBoundsException? This is obviously a user error. It would be misleading (but maybe acceptable) to substitute “null” for the placeholders, but just throwing a different exception probably isn’t worth the trouble. Ralph On Sep 2, 2014, at 7:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Log4j2's SimpleLogger Implementation Issue for var args method's
That sounds reasonable. Ralph On Sep 2, 2014, at 9:41 AM, Yogesh Rao yog...@gmail.com wrote: Hi Ralph, IMO new Object[0] as a param value is valid and should behave similar to a call to the method without param i.e. logger.error(Hello World {} in {} ); In the above context adding a conditional check params.length 0 with then the if @ line 157 wouldn't end up throwing the error and print the given message Regards, -Yogesh On Tue, Sep 2, 2014 at 9:45 PM, Ralph Goers ralph.go...@dslextreme.com wrote: What will you do instead of throwing an ArrayIndexOutOfBoundsException? This is obviously a user error. It would be misleading (but maybe acceptable) to substitute “null” for the placeholders, but just throwing a different exception probably isn’t worth the trouble. Ralph On Sep 2, 2014, at 7:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Log4j2's SimpleLogger Implementation Issue for var args method's
Camel accepts PRs. I think we should be able to do it. ICLAs still apply, though. On 2 September 2014 12:12, Ralph Goers ralph.go...@dslextreme.com wrote: That sounds reasonable. Ralph On Sep 2, 2014, at 9:41 AM, Yogesh Rao yog...@gmail.com wrote: Hi Ralph, IMO new Object[0] as a param value is valid and should behave similar to a call to the method without param i.e. logger.error(Hello World {} in {} ); In the above context adding a conditional check params.length 0 with then the if @ line 157 wouldn't end up throwing the error and print the given message Regards, -Yogesh On Tue, Sep 2, 2014 at 9:45 PM, Ralph Goers ralph.go...@dslextreme.com wrote: What will you do instead of throwing an ArrayIndexOutOfBoundsException? This is obviously a user error. It would be misleading (but maybe acceptable) to substitute “null” for the placeholders, but just throwing a different exception probably isn’t worth the trouble. Ralph On Sep 2, 2014, at 7:24 AM, Yogesh Rao yog...@gmail.com wrote: Hi, There seems to be an issue with SimpleLogger implementation provided by log4j2. The issue seems to be in the new improved API supporting placeholders and var args when called with an Object Array of size 0. for e.g logger.error(Hello World {} in {} , new Object[0]); A statement above results in an error as shown below ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger Exception in thread main java.lang.ArrayIndexOutOfBoundsException: -1 at org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) at TestError.main(TestError.java:21) I managed to look at the code as well and it looks like a condition to check of the var arg param array size is missing in SimpleLogger 155 final Object[] params = msg.getParameters(); 156 Throwable t; 157 if (throwable == null params != null params[params.length - 1] instanceof Throwable) { 158 t = (Throwable) params[params.length - 1]; 159 } else { 160 t = throwable; 161 } 162 if (t != null) { 163 sb.append(SPACE); 164 final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 165 t.printStackTrace(new PrintStream(baos)); 166 sb.append(baos.toString()); 167 } 168 stream.println(sb.toString()); I can raise a JIRA issue and provide a fix with failing unit testcase. Let me know if i can proceed ahead on this. Details of the environment are :- Version used 1. JDK - Oracle JDK version 1.7 2. Log4j2 API - 2.0.1 To reproduce following java class can be used : TestError.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class TestError { private static final Logger logger = LogManager.getLogger(TestError); /** * @param args */ public static void main(String[] args) { Object[] arr = null; logger.error(Hello World {} in {} , new Object[0]); } } Jars in Classpath -- Log4j2 API - 2.0.1 Regards, -Yogesh - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org -- Matt Sicker boa...@gmail.com