You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2015/06/23 17:38:01 UTC
[jira] [Updated] (LOG4J2-914)
ThrowableProxy.getExtendedStackTraceAsString causes NullPointerException
[ https://issues.apache.org/jira/browse/LOG4J2-914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary Gregory updated LOG4J2-914:
--------------------------------
Summary: ThrowableProxy.getExtendedStackTraceAsString causes NullPointerException (was: ThrowableProxy.getExtendedStackTraceAsString causes NullpointerException )
> 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
> Assignee: Gary Gregory
> Priority: Minor
> Fix For: 2.2
>
>
> 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:
> {code:xml}
> <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>
> {code}
> The stacktrace that I get in the server:
> {code}
> 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)
> {code}
> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org