java.lang.Throwable JIRA | jel | 1 decade ago
  1. 0

    Since jcl-over-slf4j implementation uses wrt. log4j internally org.apache.log4j.Logger, this leads to an off by one situation wrt. determination of the source line and thus always reports the SLF4JLog as source of the event because LoggingEvent#FQCN is set to org.apache.log4j.Category and not to org.apache.commons.logging.impl.SLF4JLog. E.g.: private static final Log log = LogFactory.getLog(JCLTest.class); executed like: org.apache.commons.logging.LogFactory#getLog(clazz) -->org.apache.commons.logging.impl.SLF4FLogFactory#getInstance(clazz) -->org.slf4j.LoggerFactory.getLogger(clazzName) -->org.slf4j.impl.NLOG4JLoggerFactory#getLogger(clazzName) -->org.apache.log4j.LogManager#getLogger(clazzName) -->org.apache.log4j.Hierarchy#getLogger(clazzName) -->org.apache.log4.DefaultCategoryFactory#makeNewLoggerInstance(clazzName) <--------------org.apache.log4j.Logger(clazzName) <--org.apache.commons.logging.impl.SLF4JLog(logger) logger.FCQN == org.apache.log4j.Category"test"); -->org.apache.commons.logging.impl.SLF4JLog.logger#info(String) -->org.apache.log4j.Category#info(String) -->org.apache.log4j.Category#forcedLog(FQCN, Level.INFO, message, null); -->event = new LoggingEvent(FQCN, this, level, message, t); -->#callAppenders(event); ...-->event.LocationInfo(new Throwable(), FQCN); ...-->s="stackTraceOfThrowableAsString(t)" #ibegin = s.lastIndexOf(FQCN); #ibegin += "charsTilnextLine()" #return "lineFrom(ibegin, tilEOL) So obviously, this is an error aka off by one situation, since SLF4JLog is actually the FQCN which should be used and not Category ... A stacktrace used to determine %F:%L, which makes the problem better visible: java.lang.Throwable at org.apache.log4j.spi.LoggingEvent.getLocationInformation( at org.apache.log4j.helpers.PatternParser$LocationPatternConverter.convert( at org.apache.log4j.helpers.PatternConverter.format( at org.apache.log4j.PatternLayout.format( at org.apache.log4j.WriterAppender.subAppend( at org.apache.log4j.WriterAppender.append( at org.apache.log4j.AppenderSkeleton.doAppend( at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders( at org.apache.log4j.Category.callAppenders( at org.apache.log4j.Category.forcedLog( at at at JCLTest.<init>( at JCLTest.main( Thus the result: 04:30:46,334 [main] INFO ( - test But should be: 04:30:46,334 [main] INFO ( - test So, at least if one wanna use e.g. nlog4j as its slf4j impl., logging is almost completely unusable wrt. debugging, which makes it hard to troubleshoot AS like jboss etc. ... JIRA | 1 decade ago | jel
  2. 0

    Log4j-1.3 with weblogic 8.1.6

    Oracle Community | 10 years ago | 666705
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Why Apache CXF not being used in WebLogic 12c?

    Stack Overflow | 2 years ago | FĂ©lix 1973

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.Throwable

      No message provided

      at org.apache.log4j.spi.LoggingEvent.getLocationInformation()
    2. Apache Log4j
      1. org.apache.log4j.spi.LoggingEvent.getLocationInformation(
      2. org.apache.log4j.helpers.PatternParser$LocationPatternConverter.convert(
      3. org.apache.log4j.helpers.PatternConverter.format(
      4. org.apache.log4j.PatternLayout.format(
      5. org.apache.log4j.WriterAppender.subAppend(
      6. org.apache.log4j.WriterAppender.append(
      7. org.apache.log4j.AppenderSkeleton.doAppend(
      8. org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(
      9. org.apache.log4j.Category.callAppenders(
      10. org.apache.log4j.Category.forcedLog(
      11 frames
    3. Apache Commons Logging
      1 frame
    4. Unknown
      1. JCLTest.<init>(
      2. JCLTest.main(
      2 frames