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  
18  package org.apache.logging.log4j.core;
19  
20  import org.apache.logging.log4j.Level;
21  import org.apache.logging.log4j.Marker;
22  import org.apache.logging.log4j.ThreadContext;
23  import org.apache.logging.log4j.message.Message;
24  
25  import java.io.Serializable;
26  import java.util.Map;
27  
28  /**
29   *
30   */
31  public interface LogEvent extends Serializable {
32  
33       /**
34       * Get level.
35       * @return level.
36       */
37      Level getLevel();
38  
39      /**
40       * Get logger name.
41       * @return logger name, may be null.
42       */
43      String getLoggerName();
44  
45      /**
46       * Get source of logging request.
47       * @return source of logging request, may be null.
48       */
49      StackTraceElement getSource();
50  
51      /**
52       * Get the message associated with the event.
53       *
54       * @return message.
55       */
56      Message getMessage();
57  
58      /**
59       * Get the Marker associated with the event.
60       * @return Marker
61       */
62      Marker getMarker();
63  
64      /**
65       * Get thread name.
66       * @return thread name, may be null.
67       * @doubt guess this could go into a thread context object too.
68       * (RG) Why?
69       */
70      String getThreadName();
71  
72  
73      /**
74       * Get event time in milliseconds since 1970.
75       * @return milliseconds since 1970.
76       */
77      long getMillis();
78  
79  
80      /**
81       * Get throwable associated with logging request.
82       * @return throwable, may be null.
83       */
84      Throwable getThrown();
85  
86  
87      /**
88       * Get the MDC data.
89       *
90       * @return A copy of the Mapped Diagnostic Context or null.
91       */
92      Map<String, String> getContextMap();
93  
94      /**
95       * Get the NDC data.
96       *
97       * @return A copy of the Nested Diagnostic Context or null;
98       */
99      ThreadContext.ContextStack getContextStack();
100 
101     /**
102      * Returns the fully qualified class name of the caller of the logging api.
103      * @return The fully qualified class name of the caller.
104      */
105     String getFQCN();
106 
107 }