All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.tkowalcz.tjahzi.log4j2.Header Maven / Gradle / Ivy

There is a newer version: 0.9.32
Show newest version
package pl.tkowalcz.tjahzi.log4j2;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.Node;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.config.plugins.PluginValue;
import org.apache.logging.log4j.status.StatusLogger;

@Plugin(name = "header", category = Node.CATEGORY, printObject = true)
public class Header extends Property {

    private static final Logger LOGGER = StatusLogger.getLogger();

    protected Header(String name, String value) {
        super(name, value);
    }

    @PluginFactory
    public static Header createHeader(
            @PluginAttribute("name") String name,
            @PluginValue("value") String value) {
        if (name == null) {
            LOGGER.error("Property name cannot be null");
        }

        return new Header(name, value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy