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 String getThreadName() {
082        return null;
083    }
084
085    @Override
086    public Throwable getThrown() {
087        return null;
088    }
089
090    @Override
091    public ThrowableProxy getThrownProxy() {
092        return null;
093    }
094
095    @Override
096    public long getTimeMillis() {
097        return 0;
098    }
099
100    @Override
101    public boolean isEndOfBatch() {
102        return false;
103    }
104
105    @Override
106    public boolean isIncludeLocation() {
107        return false;
108    }
109
110    @Override
111    public void setEndOfBatch(final boolean endOfBatch) {
112        // do nothing
113    }
114
115    @Override
116    public void setIncludeLocation(final boolean locationRequired) {
117        // do nothing
118    }
119
120}