View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements. See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache license, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License. You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the license for the specific language governing permissions and
15   * limitations under the license.
16   */
17  package org.apache.logging.log4j.core.jackson;
18  
19  import com.fasterxml.jackson.annotation.JsonIgnore;
20  import com.fasterxml.jackson.annotation.JsonProperty;
21  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
22  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
23  import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
24  import org.apache.logging.log4j.core.impl.ThrowableProxy;
25  
26  /**
27   * Mix-in for {@link ThrowableProxy}.
28   */
29  abstract class ThrowableProxyWithoutStacktraceMixIn {
30  
31      @JsonProperty(JsonConstants.ELT_CAUSE)
32      @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CAUSE)
33      private ThrowableProxyWithoutStacktraceMixIn causeProxy;
34  
35      @JsonProperty
36      @JacksonXmlProperty(isAttribute = true)
37      private int commonElementCount;
38  
39      @JsonIgnore
40      private ExtendedStackTraceElement[] extendedStackTrace;
41  
42      @JsonProperty
43      @JacksonXmlProperty(isAttribute = true)
44      private String localizedMessage;
45  
46      @JsonProperty
47      @JacksonXmlProperty(isAttribute = true)
48      private String message;
49  
50      @JsonProperty
51      @JacksonXmlProperty(isAttribute = true)
52      private String name;
53  
54      @JsonIgnore
55      private transient Throwable throwable;
56  
57      @JsonIgnore
58      public abstract String getCauseStackTraceAsString();
59  
60      @JsonIgnore
61      public abstract String getExtendedStackTraceAsString();
62  
63      @JsonIgnore
64      public abstract StackTraceElement[] getStackTrace();
65  
66      @JsonProperty(JsonConstants.ELT_SUPPRESSED)
67      @JacksonXmlElementWrapper(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED)
68      @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED_ITEM)
69      public abstract ThrowableProxy[] getSuppressedProxies();
70  
71      @JsonIgnore
72      public abstract String getSuppressedStackTrace();
73  
74      @JsonIgnore
75      public abstract Throwable getThrowable();
76  
77  }