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 2014/12/05 16:09:13 UTC
[jira] [Commented] (LOG4J2-914)
ThrowableProxy.getExtendedStackTraceAsString causes NullpointerException
[ https://issues.apache.org/jira/browse/LOG4J2-914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14235582#comment-14235582 ]
Gary Gregory commented on LOG4J2-914:
-------------------------------------
Kaj,
Thank you for reporting this issue. I've committed a fix to Git master.
Can you try with the current 2.2-SNAPSHOT build to confirm the fix and report back here?
To get the snapshot, point maven to our snapshot repository here: https://repository.apache.org/content/repositories/snapshots
You can also download the sources from Git and build locally.
Thank you,
Gary
> 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