I have recently found a bug that causes a NullPointerException. The exception is caught and logged using a standard slf4j statement. Abridged code below:
for
Is it possible that this code is in an inner loop? Then then JIT compiler might be compiling the call stack for this to native code, losing the stack information. Then when you attach the debugger it disables the JIT, making the information available again.
The other manual exceptions keep displaying the information as the JIT is not optimising.
It looks like this can sometimes happen for others from a comment in this class source code at line 102:
http://logging.apache.org/log4j/1.2/xref/org/apache/log4j/spi/LocationInfo.html