001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache license, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the license for the specific language governing permissions and 015 * limitations under the license. 016 */ 017 018 package org.apache.logging.log4j.core; 019 020 import org.apache.logging.log4j.Level; 021 import org.apache.logging.log4j.Marker; 022 import org.apache.logging.log4j.ThreadContext; 023 import org.apache.logging.log4j.message.Message; 024 025 import java.io.Serializable; 026 import java.util.Map; 027 028 /** 029 * 030 */ 031 public interface LogEvent extends Serializable { 032 033 /** 034 * Get level. 035 * @return level. 036 */ 037 Level getLevel(); 038 039 /** 040 * Get logger name. 041 * @return logger name, may be null. 042 */ 043 String getLoggerName(); 044 045 /** 046 * Get source of logging request. 047 * @return source of logging request, may be null. 048 */ 049 StackTraceElement getSource(); 050 051 /** 052 * Get the message associated with the event. 053 * 054 * @return message. 055 */ 056 Message getMessage(); 057 058 /** 059 * Get the Marker associated with the event. 060 * @return Marker 061 */ 062 Marker getMarker(); 063 064 /** 065 * Get thread name. 066 * @return thread name, may be null. 067 * @doubt guess this could go into a thread context object too. 068 * (RG) Why? 069 */ 070 String getThreadName(); 071 072 073 /** 074 * Get event time in milliseconds since 1970. 075 * @return milliseconds since 1970. 076 */ 077 long getMillis(); 078 079 080 /** 081 * Get throwable associated with logging request. 082 * @return throwable, may be null. 083 */ 084 Throwable getThrown(); 085 086 087 /** 088 * Get the MDC data. 089 * 090 * @return A copy of the Mapped Diagnostic Context or null. 091 */ 092 Map<String, String> getContextMap(); 093 094 /** 095 * Get the NDC data. 096 * 097 * @return A copy of the Nested Diagnostic Context or null; 098 */ 099 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 }