After a while of consideration, I think it should print "null". Maybe "null" does indicate a problem in my code. If it is silently discarded I do not get it. Maybe I just want to output if there is an object or not. Thats also not possible. However, their might be reason to output just "null", be it best practice or not.
On Thu, Jan 10, 2013 at 9:39 PM, Ralph Goers <[email protected]> wrote: > That is a good question. Most of the converters simply don't add anything to > the buffer if they have no content, but "null" isn't necessarily the same > thing as no content. > > Ralph > > > On Jan 10, 2013, at 12:33 PM, Gary Gregory wrote: > > What should be the expected output? "null" or a no-op? > > Gary > > > On Thu, Jan 10, 2013 at 6:42 AM, Christian Grobmeier <[email protected]> > wrote: >> >> Folks, >> >> i am doing this: >> >> logger.debug(line) >> >> where line is null. Please not, if I do sysout(line) before the error >> does not happen. >> >> The exception is below. I believe it is because: >> >> toAppendTo.append(config != null && result.contains("${") ? >> config.getSubst().replace(event, result) : result); >> >> >> toAppendTo is null when I put null into .debug thus it crashes. >> Shouldn't it be nullsafe? I can imagine people are putting null into >> that messages. >> >> Cheers >> Christian >> >> >> ERROR StatusLogger An exception occurred processing Appender STDOUT >> java.lang.NullPointerException >> at >> org.apache.logging.log4j.core.pattern.MessagePatternConverter.format(MessagePatternConverter.java:70) >> at >> org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:36) >> at >> org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:141) >> at >> org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:48) >> at >> org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:56) >> at >> org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:112) >> at >> org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:98) >> at >> org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:335) >> at >> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:316) >> at >> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:319) >> at >> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:281) >> at org.apache.logging.log4j.core.Logger.log(Logger.java:106) >> at >> org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLoggerWrapper.java:53) >> at org.slf4j.impl.SLF4JLogger.debug(SLF4JLogger.java:129) >> >> -- >> http://www.grobmeier.de >> https://www.timeandbill.de >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > > -- > E-Mail: [email protected] | [email protected] > JUnit in Action, 2nd Ed: http://bit.ly/ECvg0 > Spring Batch in Action: http://bit.ly/bqpbCK > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > > -- http://www.grobmeier.de https://www.timeandbill.de --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
