[ 
https://issues.apache.org/jira/browse/LOG4J2-914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kaj Bjurman updated LOG4J2-914:
-------------------------------
    Priority: Minor  (was: Major)

> ThrowableProxy.getExtendedStackTraceAsString causes NullpointerException 
> -------------------------------------------------------------------------
>
>                 Key: LOG4J2-914
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-914
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1
>            Reporter: Kaj Bjurman
>            Priority: Minor
>
> I'm trying to write a poc with Log4j 2.1, where distributed processes are 
> logging to a remote server. The server is currently running the bundled 
> TcpSocketServer.createSerializedSocketServer with a custom layout plugin. 
> A process is logging an exception. I can then see in the custom layout plugin 
> at the log server that the LogEvent doesn't contain a thrown, but that it 
> contains a thrownProxy. So far so good. I'm then trying to get hold of a 
> String representation of the message + stacktrace. I thought that I would be 
> able to e.g invoke ThrowableProxy.getExtendedStackTraceAsString(), but that 
> causes a NullPointerException since the throwable in the ThrowableProxy also 
> is null after deserialization. Looks like ThrowableProxy assumes that 
> throwable isn't null in a few methods. 
> The exception that is logged by the client process is a simple new 
> Exception("A message");
> The pom.xml that I'm using:
> <dependency>
>       <groupId>org.apache.logging.log4j</groupId>
>       <artifactId>log4j-api</artifactId>
>       <version>2.1</version>
> </dependency>
> <dependency>
>       <groupId>org.apache.logging.log4j</groupId>
>       <artifactId>log4j-core</artifactId>
>       <version>2.1</version>
> </dependency>
> <dependency>
>       <groupId>com.lmax</groupId>
>       <artifactId>disruptor</artifactId>
>       <version>3.3.0</version>
> </dependency>
> The stacktrace that I get in the server:
> 2014-12-05 14:30:44,601 ERROR An exception occurred processing Appender XXXXX 
> java.lang.NullPointerException
>       at 
> org.apache.logging.log4j.core.impl.ThrowableProxy.getExtendedStackTraceAsString(ThrowableProxy.java:340)
>       at 
> org.apache.logging.log4j.core.impl.ThrowableProxy.getExtendedStackTraceAsString(ThrowableProxy.java:323)
> Workaround:
> To invoke ThrowableProxy. getExtendedStackTrace() and format the stacktrace + 
> message with my own format methods.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to