[ https://issues.apache.org/jira/browse/LOG4J2-180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13748799#comment-13748799 ]
Gary Gregory edited comment on LOG4J2-180 at 8/23/13 6:09 PM: -------------------------------------------------------------- For this first issue, as of the HEAD of trunk now, I am thinking this is a configuration issue. Here is my example: {code:xml} <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{ABSOLUTE} %-5level # %class.%method %m %style{%ex{1}}{green}%n" /> </Console> {code} I get: {noformat} 14:03:58,661 FATAL # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Fatal message. 14:03:58,663 ERROR # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Error message. 14:03:58,664 WARN # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Warning message. 14:03:58,664 INFO # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Information message. 14:03:58,664 DEBUG # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Debug message. 14:03:58,664 TRACE # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Trace message. 14:03:58,664 ERROR # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Error message. java.lang.NullPointerException 14:03:58,668 ERROR # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main catching java.lang.NullPointerException {noformat} Please see: - https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml - https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java Please comment here or mark the issue as resolved. was (Author: garydgregory): For this first issue, as of the HEAD of trunk now, I am thinking this is a configuration issue. Here is my example: {code:xml} <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{ABSOLUTE} %-5level # %class.%method %m %style{%ex{1}}{green}%n" /> </Console> {code} I get: {noformat} 14:03:58,661 FATAL # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Fatal message. 14:03:58,663 ERROR # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Error message. 14:03:58,664 WARN # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Warning message. 14:03:58,664 INFO # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Information message. 14:03:58,664 DEBUG # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Debug message. 14:03:58,664 TRACE # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Trace message. 14:03:58,664 ERROR # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main Error message. java.lang.NullPointerException 14:03:58,668 ERROR # org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main.main catching java.lang.NullPointerException {noformat} Please see: - https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml - https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java > style & highlight patterns altering content behaviour > ----------------------------------------------------- > > Key: LOG4J2-180 > URL: https://issues.apache.org/jira/browse/LOG4J2-180 > Project: Log4j 2 > Issue Type: Bug > Components: Layouts > Affects Versions: 2.0-beta4 > Reporter: Seyguai > Priority: Minor > > - Using style or highlight patterns over a Throwable pattern makes this code > useless if the exception is the only content (i.e. "%highlight{%ex}") > {code:java} > org.apache.logging.log4j.core.pattern.ThrowablePatternConverter:format(final > LogEvent event, final StringBuilder toAppendTo) { > ... > final int len = toAppendTo.length(); > if (len > 0 && !Character.isWhitespace(toAppendTo.charAt(len - > 1))) { > toAppendTo.append(" "); // Add a space before printing stack > trace > } > ... > } > {code} > (With style or highlight patterns, the format is called with a new empty > StringBuilder) > Example: > {noformat} > 17:26:54.395 ERROR # Server.doOperation catchingjava.lang.NullPointerException > {noformat} > (Syntax affected, no space between the message 'catching' and the exception > 'java.lang.NullPointerException') > - Using style or highlight patterns over a Throwable pattern makes it to be > duplicated (the pattern is interpreted as if there was nothing dealing with > throwables) > Examples: > {noformat} > Simple pattern: "%m %ex{short}" > Output: catching java.lang.NullPointerException > at net.wm.core.prototype.Server.doOperation(Server.java:27) > {noformat} > {noformat} > Pattern with highlight: "%m %highlight{%ex{short}}" > Output: catching java.lang.NullPointerException > at net.wm.core.prototype.Server.doOperation(Server.java:27) > java.lang.NullPointerException > at net.wm.core.prototype.Server.doOperation(Server.java:27) [bin/:?] > at net.wm.core.AbstractOperation.run(AbstractOperation.java:99) > [bin/:?] > at java.lang.Thread.run(Unknown Source) [?:1.7.0_07] > {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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org