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 */
017package org.apache.logging.log4j.core;
018
019import java.util.Collections;
020import java.util.Map;
021
022import org.apache.logging.log4j.Level;
023import org.apache.logging.log4j.Marker;
024import org.apache.logging.log4j.ThreadContext;
025import org.apache.logging.log4j.ThreadContext.ContextStack;
026import org.apache.logging.log4j.core.impl.ThrowableProxy;
027import org.apache.logging.log4j.message.Message;
028
029
030/**
031 * An abstract log event implementation with default values for all methods. The setters are no-ops.
032 */
033public abstract class AbstractLogEvent implements LogEvent {
034
035    private static final long serialVersionUID = 1L;
036
037    /**
038     * Returns {@link Collections#emptyMap()}.
039     */
040    @Override
041    public Map<String, String> getContextMap() {
042        return Collections.emptyMap();
043    }
044
045    @Override
046    public ContextStack getContextStack() {
047        return ThreadContext.EMPTY_STACK;
048    }
049
050    @Override
051    public Level getLevel() {
052        return null;
053    }
054
055    @Override
056    public String getLoggerFqcn() {
057        return null;
058    }
059
060    @Override
061    public String getLoggerName() {
062        return null;
063    }
064
065    @Override
066    public Marker getMarker() {
067        return null;
068    }
069
070    @Override
071    public Message getMessage() {
072        return null;
073    }
074
075    @Override
076    public StackTraceElement getSource() {
077        return null;
078    }
079
080    @Override
081    public long getThreadId() {
082        return 0;
083    }
084
085    @Override
086    public String getThreadName() {
087        return null;
088    }
089
090    @Override
091    public int getThreadPriority() {
092        return 0;
093    }
094
095    @Override
096    public Throwable getThrown() {
097        return null;
098    }
099
100    @Override
101    public ThrowableProxy getThrownProxy() {
102        return null;
103    }
104
105    @Override
106    public long getTimeMillis() {
107        return 0;
108    }
109
110    @Override
111    public boolean isEndOfBatch() {
112        return false;
113    }
114
115    @Override
116    public boolean isIncludeLocation() {
117        return false;
118    }
119
120    @Override
121    public void setEndOfBatch(final boolean endOfBatch) {
122        // do nothing
123    }
124
125    @Override
126    public void setIncludeLocation(final boolean locationRequired) {
127        // do nothing
128    }
129
130    @Override
131    public long getNanoTime() {
132        return 0;
133    }
134}