public class ThrowableProxy extends Object implements Serializable
A proxy is used to represent a throwable that may not exist in a different class loader or JVM. When an application deserializes a ThrowableProxy, the throwable may not be set, but the throwable's information is preserved in other fields of the proxy like the message and stack trace.
TODO: Move this class to org.apache.logging.log4j.core because it is used from LogEvent.
TODO: Deserialize: Try to rebuild Throwable if the target exception is in this class loader?
Constructor and Description |
---|
ThrowableProxy(Throwable throwable)
Constructs the wrapper for the Throwable that includes packaging data.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
void |
formatExtendedStackTraceTo(StringBuilder sb,
List<String> ignorePackages,
org.apache.logging.log4j.core.pattern.TextRenderer textRenderer,
String suffix,
String lineSeparator)
Formats the stack trace including packaging information.
|
void |
formatWrapper(StringBuilder sb,
ThrowableProxy cause,
List<String> ignorePackages,
String suffix)
Formats the specified Throwable.
|
void |
formatWrapper(StringBuilder sb,
ThrowableProxy cause,
List<String> ignorePackages,
org.apache.logging.log4j.core.pattern.TextRenderer textRenderer,
String suffix)
Formats the specified Throwable.
|
void |
formatWrapper(StringBuilder sb,
ThrowableProxy cause,
List<String> ignorePackages,
org.apache.logging.log4j.core.pattern.TextRenderer textRenderer,
String suffix,
String lineSeparator)
Formats the specified Throwable.
|
void |
formatWrapper(StringBuilder sb,
ThrowableProxy cause,
String suffix)
Formats the specified Throwable.
|
ThrowableProxy |
getCauseProxy() |
String |
getCauseStackTraceAsString(List<String> packages,
String suffix)
Formats the Throwable that is the cause of this Throwable.
|
String |
getCauseStackTraceAsString(List<String> ignorePackages,
org.apache.logging.log4j.core.pattern.TextRenderer textRenderer,
String suffix)
Formats the Throwable that is the cause of this Throwable.
|
String |
getCauseStackTraceAsString(List<String> ignorePackages,
org.apache.logging.log4j.core.pattern.TextRenderer textRenderer,
String suffix,
String lineSeparator)
Formats the Throwable that is the cause of this Throwable.
|
String |
getCauseStackTraceAsString(String suffix)
Formats the Throwable that is the cause of this Throwable.
|
int |
getCommonElementCount()
Returns the number of elements that are being omitted because they are common with the parent Throwable's stack
trace.
|
org.apache.logging.log4j.core.impl.ExtendedStackTraceElement[] |
getExtendedStackTrace()
Gets the stack trace including packaging information.
|
String |
getExtendedStackTraceAsString()
Formats the stack trace including packaging information.
|
String |
getExtendedStackTraceAsString(List<String> ignorePackages,
String suffix)
Formats the stack trace including packaging information.
|
String |
getExtendedStackTraceAsString(List<String> ignorePackages,
org.apache.logging.log4j.core.pattern.TextRenderer textRenderer,
String suffix)
Formats the stack trace including packaging information.
|
String |
getExtendedStackTraceAsString(List<String> ignorePackages,
org.apache.logging.log4j.core.pattern.TextRenderer textRenderer,
String suffix,
String lineSeparator)
Formats the stack trace including packaging information.
|
String |
getExtendedStackTraceAsString(String suffix)
Formats the stack trace including packaging information.
|
String |
getLocalizedMessage() |
String |
getMessage() |
String |
getName()
Return the FQCN of the Throwable.
|
StackTraceElement[] |
getStackTrace() |
ThrowableProxy[] |
getSuppressedProxies()
Gets proxies for suppressed exceptions.
|
String |
getSuppressedStackTrace(String suffix)
Formats the suppressed Throwables.
|
Throwable |
getThrowable()
The throwable or null if this object is deserialized from XML or JSON.
|
int |
hashCode() |
String |
toString() |
public ThrowableProxy(Throwable throwable)
throwable
- The Throwable to wrap, must not be null.public void formatWrapper(StringBuilder sb, ThrowableProxy cause, String suffix)
sb
- StringBuilder to contain the formatted Throwable.cause
- The Throwable to format.suffix
- public void formatWrapper(StringBuilder sb, ThrowableProxy cause, List<String> ignorePackages, String suffix)
sb
- StringBuilder to contain the formatted Throwable.cause
- The Throwable to format.ignorePackages
- The List of packages to be suppressed from the trace.suffix
- public void formatWrapper(StringBuilder sb, ThrowableProxy cause, List<String> ignorePackages, org.apache.logging.log4j.core.pattern.TextRenderer textRenderer, String suffix)
sb
- StringBuilder to contain the formatted Throwable.cause
- The Throwable to format.ignorePackages
- The List of packages to be suppressed from the stack trace.textRenderer
- The text renderer.suffix
- Append this to the end of each stack frame.public void formatWrapper(StringBuilder sb, ThrowableProxy cause, List<String> ignorePackages, org.apache.logging.log4j.core.pattern.TextRenderer textRenderer, String suffix, String lineSeparator)
sb
- StringBuilder to contain the formatted Throwable.cause
- The Throwable to format.ignorePackages
- The List of packages to be suppressed from the stack trace.textRenderer
- The text renderer.suffix
- Append this to the end of each stack frame.lineSeparator
- The end-of-line separator.public ThrowableProxy getCauseProxy()
public String getCauseStackTraceAsString(String suffix)
suffix
- public String getCauseStackTraceAsString(List<String> packages, String suffix)
packages
- The List of packages to be suppressed from the trace.suffix
- Append this to the end of each stack frame.public String getCauseStackTraceAsString(List<String> ignorePackages, org.apache.logging.log4j.core.pattern.TextRenderer textRenderer, String suffix)
ignorePackages
- The List of packages to be suppressed from the trace.textRenderer
- The text renderer.suffix
- Append this to the end of each stack frame.public String getCauseStackTraceAsString(List<String> ignorePackages, org.apache.logging.log4j.core.pattern.TextRenderer textRenderer, String suffix, String lineSeparator)
ignorePackages
- The List of packages to be suppressed from the stack trace.textRenderer
- The text renderer.suffix
- Append this to the end of each stack frame.lineSeparator
- The end-of-line separator.public int getCommonElementCount()
public org.apache.logging.log4j.core.impl.ExtendedStackTraceElement[] getExtendedStackTrace()
public String getExtendedStackTraceAsString()
public String getExtendedStackTraceAsString(String suffix)
suffix
- Append this to the end of each stack frame.public String getExtendedStackTraceAsString(List<String> ignorePackages, String suffix)
ignorePackages
- List of packages to be ignored in the trace.suffix
- Append this to the end of each stack frame.public String getExtendedStackTraceAsString(List<String> ignorePackages, org.apache.logging.log4j.core.pattern.TextRenderer textRenderer, String suffix)
ignorePackages
- List of packages to be ignored in the trace.textRenderer
- The message renderer.suffix
- Append this to the end of each stack frame.public String getExtendedStackTraceAsString(List<String> ignorePackages, org.apache.logging.log4j.core.pattern.TextRenderer textRenderer, String suffix, String lineSeparator)
ignorePackages
- List of packages to be ignored in the trace.textRenderer
- The message renderer.suffix
- Append this to the end of each stack frame.lineSeparator
- The end-of-line separator.public void formatExtendedStackTraceTo(StringBuilder sb, List<String> ignorePackages, org.apache.logging.log4j.core.pattern.TextRenderer textRenderer, String suffix, String lineSeparator)
sb
- Destination.ignorePackages
- List of packages to be ignored in the trace.textRenderer
- The message renderer.suffix
- Append this to the end of each stack frame.lineSeparator
- The end-of-line separator.public String getLocalizedMessage()
public String getMessage()
public String getName()
public StackTraceElement[] getStackTrace()
public ThrowableProxy[] getSuppressedProxies()
public String getSuppressedStackTrace(String suffix)
suffix
- public Throwable getThrowable()
Copyright © 2006–2020 OPS4J - Open Participation Software for Java. All rights reserved.