Java Examples for org.apache.logging.log4j.core.config.plugins.PluginFactory

The following java examples will help you to understand the usage of org.apache.logging.log4j.core.config.plugins.PluginFactory. These source code samples are taken from different open source projects.

Example 1
Project: logging-log4j2-master  File: Rfc5424Layout.java View source code
/**
     * Create the RFC 5424 Layout.
     *
     * @param facility The Facility is used to try to classify the message.
     * @param id The default structured data id to use when formatting according to RFC 5424.
     * @param enterpriseNumber The IANA enterprise number.
     * @param includeMDC Indicates whether data from the ThreadContextMap will be included in the RFC 5424 Syslog
     *            record. Defaults to "true:.
     * @param mdcId The id to use for the MDC Structured Data Element.
     * @param mdcPrefix The prefix to add to MDC key names.
     * @param eventPrefix The prefix to add to event key names.
     * @param newLine If true, a newline will be appended to the end of the syslog record. The default is false.
     * @param escapeNL String that should be used to replace newlines within the message text.
     * @param appName The value to use as the APP-NAME in the RFC 5424 syslog record.
     * @param msgId The default value to be used in the MSGID field of RFC 5424 syslog records.
     * @param excludes A comma separated list of MDC keys that should be excluded from the LogEvent.
     * @param includes A comma separated list of MDC keys that should be included in the FlumeEvent.
     * @param required A comma separated list of MDC keys that must be present in the MDC.
     * @param exceptionPattern The pattern for formatting exceptions.
     * @param useTlsMessageFormat If true the message will be formatted according to RFC 5425.
     * @param loggerFields Container for the KeyValuePairs containing the patterns
     * @param config The Configuration. Some Converters require access to the Interpolator.
     * @return An Rfc5424Layout.
     */
@PluginFactory
public static Rfc5424Layout createLayout(// @formatter:off
@PluginAttribute(value = "facility", defaultString = "LOCAL0") final Facility facility, @PluginAttribute("id") final String id, @PluginAttribute(value = "enterpriseNumber", defaultInt = DEFAULT_ENTERPRISE_NUMBER) final int enterpriseNumber, @PluginAttribute(value = "includeMDC", defaultBoolean = true) final boolean includeMDC, @PluginAttribute(value = "mdcId", defaultString = DEFAULT_MDCID) final String mdcId, @PluginAttribute("mdcPrefix") final String mdcPrefix, @PluginAttribute("eventPrefix") final String eventPrefix, @PluginAttribute(value = "newLine") final boolean newLine, @PluginAttribute("newLineEscape") final String escapeNL, @PluginAttribute("appName") final String appName, @PluginAttribute("messageId") final String msgId, @PluginAttribute("mdcExcludes") final String excludes, @PluginAttribute("mdcIncludes") String includes, @PluginAttribute("mdcRequired") final String required, @PluginAttribute("exceptionPattern") final String exceptionPattern, // RFC 5425
@PluginAttribute(value = "useTlsMessageFormat") final boolean useTlsMessageFormat, @PluginElement("LoggerFields") final LoggerFields[] loggerFields, @PluginConfiguration final Configuration config) {
    // @formatter:on
    if (includes != null && excludes != null) {
        LOGGER.error("mdcIncludes and mdcExcludes are mutually exclusive. Includes wil be ignored");
        includes = null;
    }
    return new Rfc5424Layout(config, facility, id, enterpriseNumber, includeMDC, newLine, escapeNL, mdcId, mdcPrefix, eventPrefix, appName, msgId, excludes, includes, required, StandardCharsets.UTF_8, exceptionPattern, useTlsMessageFormat, loggerFields);
}
Example 2
Project: Chronicle-Logger-master  File: AbstractChronicleAppender.java View source code
@PluginFactory
public static IndexedChronicleCfg create(@PluginAttribute("indexFileCapacity") final String indexFileCapacity, @PluginAttribute("indexFileExcerpts") final String indexFileExcerpts, @PluginAttribute("indexBlockSize") final String indexBlockSize, @PluginAttribute("useUnsafe") final String useUnsafe, @PluginAttribute("synchronousMode") final String synchronousMode, @PluginAttribute("cacheLineSize") final String cacheLineSize, @PluginAttribute("messageCapacity") final String messageCapacity, @PluginAttribute("minimiseFootprint") final String minimiseFootprint, @PluginAttribute("useCheckedExcerpt") final String useCheckedExcerpt, @PluginAttribute("dataBlockSize") final String dataBlockSize, @PluginAttribute("useCompressedObjectSerializer") final String useCompressedObjectSerializer) {
    final IndexedChronicleCfg cfg = new IndexedChronicleCfg();
    cfg.setProperty("indexFileCapacity", indexFileCapacity);
    cfg.setProperty("useUnsafe", useUnsafe);
    cfg.setProperty("indexBlockSize", indexBlockSize);
    cfg.setProperty("synchronousMode", synchronousMode);
    cfg.setProperty("cacheLineSize", cacheLineSize);
    cfg.setProperty("messageCapacity", messageCapacity);
    cfg.setProperty("minimiseFootprint", minimiseFootprint);
    cfg.setProperty("useCheckedExcerpt", useCheckedExcerpt);
    cfg.setProperty("dataBlockSize", dataBlockSize);
    cfg.setProperty("indexFileExcerpts", indexFileExcerpts);
    cfg.setProperty("useCompressedObjectSerializer", useCompressedObjectSerializer);
    return cfg;
}
Example 3
Project: le_java-master  File: LogentriesAppender.java View source code
@PluginFactory
public static LogentriesAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("token") String token, @PluginAttribute("key") String key, @PluginAttribute("location") String location, @PluginAttribute("httpPut") boolean httpPut, @PluginAttribute("ssl") boolean ssl, @PluginAttribute("debug") boolean debug, @PluginAttribute("useDataHub") boolean useDataHub, @PluginAttribute("dataHubAddr") String dataHubAddr, @PluginAttribute("dataHubPort") int dataHubPort, @PluginAttribute("logHostName") boolean logHostName, @PluginAttribute("hostName") String hostName, @PluginAttribute("logID") String logID, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") Filter filter) {
    if (name == null) {
        LOGGER.error("No name provided for LogentriesAppender");
        return null;
    }
    if (token == null) {
        LOGGER.error("No token provided for LogentriesAppender");
        return null;
    }
    FactoryData data = new FactoryData(token, key, location, httpPut, ssl, debug, useDataHub, dataHubAddr, dataHubPort, logHostName, hostName, logID);
    LogentriesManager manager = LogentriesManager.getManager(name, data);
    if (manager == null)
        return null;
    if (layout == null)
        layout = PatternLayout.createDefaultLayout();
    return new LogentriesAppender(name, filter, layout, ignoreExceptions, manager);
}
Example 4
Project: logstash-gelf-master  File: GelfLogField.java View source code
@PluginFactory
public static GelfLogField createField(@PluginConfiguration final Configuration config, @PluginAttribute("name") String name, @PluginAttribute("literal") String literalValue, @PluginAttribute("mdc") String mdc, @PluginAttribute("pattern") String pattern) {
    final boolean isPattern = Strings.isNotEmpty(pattern);
    final boolean isLiteralValue = Strings.isNotEmpty(literalValue);
    final boolean isMDC = Strings.isNotEmpty(mdc);
    if (Strings.isEmpty(name)) {
        LOGGER.error("The name is empty");
        return null;
    }
    if ((isPattern && isLiteralValue) || (isPattern && isMDC) || (isLiteralValue && isMDC)) {
        LOGGER.error("The pattern, literal, and mdc attributes are mutually exclusive.");
        return null;
    }
    if (isPattern) {
        PatternLayout patternLayout = newBuilder().withPattern(pattern).withConfiguration(config).withNoConsoleNoAnsi(false).withAlwaysWriteExceptions(false).build();
        return new GelfLogField(name, null, null, patternLayout);
    }
    return new GelfLogField(name, literalValue, mdc, null);
}
Example 5
Project: graylog2-server-master  File: MemoryAppender.java View source code
@PluginFactory
public static MemoryAppender createAppender(@PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter") final Filter filter, @PluginAttribute("name") final String name, @PluginAttribute(value = "bufferSize", defaultInt = 500) final String bufferSize, @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) final String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for MemoryAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    final int size = Integer.parseInt(bufferSize);
    final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
    return new MemoryAppender(name, filter, layout, ignoreExceptions, size);
}
Example 6
Project: openclouddb-master  File: Property.java View source code
/**
     * Create a Property.
     * @param key The key.
     * @param value The value.
     * @return A Property.
     */
@PluginFactory
public static Property createProperty(@PluginAttribute("name") final String key, @PluginValue("value") final String value) {
    if (key == null) {
        LOGGER.error("Property key cannot be null");
    }
    if (value.contains("${")) {
        List<String> keys = new ArrayList<String>();
        List<String> values = new ArrayList<String>();
        String _value = value;
        Matcher m = pat.matcher(_value);
        while (m.find()) {
            String _key = m.group();
            keys.add(_key);
            values.add(System.getProperty(_key.substring(2, _key.lastIndexOf('}'))));
        }
        for (int i = 0; i < keys.size(); i++) {
            _value = _value.replaceAll("[${][^$][" + keys.get(i) + "]*}", values.get(i));
        }
        return new Property(key, _value);
    } else {
        return new Property(key, value);
    }
}
Example 7
Project: radargun-master  File: PerNodeRollingRandomAccessFileAppender.java View source code
@PluginFactory
public static PerNodeRollingRandomAccessFileAppender createAppender(@PluginAttribute("fileName") final String fileName, @PluginAttribute("filePattern") final String filePattern, @PluginAttribute("append") final String append, @PluginAttribute("name") final String name, @PluginAttribute("immediateFlush") final String immediateFlush, @PluginAttribute("bufferSizeStr") final String bufferSizeStr, @PluginElement("Policy") final TriggeringPolicy policy, @PluginElement("Strategy") RolloverStrategy strategy, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter") final Filter filter, @PluginAttribute("ignoreExceptions") final String ignore, @PluginAttribute("advertise") final String advertise, @PluginAttribute("advertiseURI") final String advertiseURI, @PluginConfiguration final Configuration config) {
    RollingRandomAccessFileAppender appender = RollingRandomAccessFileAppender.createAppender(appendNodeIndex(fileName), appendNodeIndex(filePattern), append, name, immediateFlush, bufferSizeStr, policy, strategy, layout, filter, ignore, advertise, advertiseURI, config);
    return new PerNodeRollingRandomAccessFileAppender(appender);
}
Example 8
Project: hive-master  File: LlapWrappedAppender.java View source code
@PluginFactory
public static LlapWrappedAppender createAppender(// This isn't really used for anything.
@PluginAttribute("name") final String name, @PluginAttribute("renameFileOnClose") final String renameFileOnCloseProvided, @PluginAttribute("renamedFileSuffix") final String renamedFileSuffixProvided, @PluginNode final Node node, @PluginConfiguration final Configuration config) {
    if (config == null) {
        LOGGER.error("PluginConfiguration not expected to be null");
        return null;
    }
    if (node == null) {
        LOGGER.error("Node must be specified as an appender specification");
        return null;
    }
    boolean renameFileOnClose = DEFAULT_RENAME_FILES_ON_CLOSE;
    if (Strings.isNotBlank(renameFileOnCloseProvided)) {
        renameFileOnClose = Boolean.parseBoolean(renameFileOnCloseProvided);
    }
    String renamedFileSuffix = DEFAULT_RENAMED_FILE_SUFFIX;
    if (Strings.isNotBlank(renamedFileSuffixProvided)) {
        renamedFileSuffix = renamedFileSuffixProvided;
    }
    return new LlapWrappedAppender(name, node, config, renameFileOnClose, renamedFileSuffix);
}
Example 9
Project: LanternServer-master  File: TerminalConsoleAppender.java View source code
@PluginFactory
public static TerminalConsoleAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Filters") Filter filter, @PluginElement("Layout") @Nullable Layout<? extends Serializable> layout, @PluginAttribute("ignoreExceptions") String ignore) {
    //noinspection ConstantConditions
    if (name == null) {
        LOGGER.error("No name provided for TerminalConsoleAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.newBuilder().build();
    }
    final boolean ignoreExceptions = parseBoolean(ignore, true);
    // This is handled by jline
    System.setProperty("log4j.skipJansi", "true");
    return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions);
}
Example 10
Project: log4j2-elasticsearch-master  File: ElasticsearchProvider.java View source code
/**
     * Factory method for creating an Elasticsearch provider within the plugin manager.
     *
     * @param cluster The name of the Elasticsearch cluster to which log event documents will be written.
     * @param host    The host name an Elasticsearch server node of the cluster, defaults to localhost.
     * @param port    The port that Elasticsearch is listening on, defaults to 9300
     * @param index   The index that Elasticsearch shall use for indexing
     * @param type    The type of the index Elasticsearch shall use for indexing
     * @return a new Elasticsearch provider
     */
@PluginFactory
public static ElasticsearchProvider createNoSqlProvider(@PluginAttribute("cluster") String cluster, @PluginAttribute("host") String host, @PluginAttribute("port") Integer port, @PluginAttribute("index") String index, @PluginAttribute("type") String type, @PluginAttribute("timeout") String timeout, @PluginAttribute("maxActionsPerBulkRequest") Integer maxActionsPerBulkRequest, @PluginAttribute("maxConcurrentBulkRequests") Integer maxConcurrentBulkRequests, @PluginAttribute("maxVolumePerBulkRequest") String maxVolumePerBulkRequest, @PluginAttribute("flushInterval") String flushInterval) {
    if (cluster == null || cluster.isEmpty()) {
        cluster = "elasticsearch";
    }
    if (host == null || host.isEmpty()) {
        host = "localhost";
    }
    if (port == null || port == 0) {
        port = 9300;
    }
    if (index == null || index.isEmpty()) {
        index = "log4j2";
    }
    if (type == null || type.isEmpty()) {
        type = "log4j2";
    }
    if (timeout == null || timeout.isEmpty()) {
        timeout = "30s";
    }
    if (maxActionsPerBulkRequest == null) {
        maxActionsPerBulkRequest = 1000;
    }
    if (maxConcurrentBulkRequests == null) {
        maxConcurrentBulkRequests = 2 * Runtime.getRuntime().availableProcessors();
    }
    if (maxVolumePerBulkRequest == null || maxVolumePerBulkRequest.isEmpty()) {
        maxVolumePerBulkRequest = "10m";
    }
    Settings settings = settingsBuilder().put("cluster.name", cluster).put("network.server", false).put("node.client", true).put("client.transport.sniff", true).put("client.transport.ping_timeout", timeout).put("client.transport.ignore_cluster_name", false).put("client.transport.nodes_sampler_interval", "30s").build();
    TransportClient client = new TransportClient(settings, false);
    client.addTransportAddress(new InetSocketTransportAddress(host, port));
    if (client.connectedNodes().isEmpty()) {
        logger.error("unable to connect to Elasticsearch cluster");
        return null;
    }
    String description = "cluster=" + cluster + ",host=" + host + ",port=" + port + ",index=" + index + ",type=" + type;
    ElasticsearchTransportClient elasticsearchTransportClient = new ElasticsearchTransportClient(client, index, type, maxActionsPerBulkRequest, maxConcurrentBulkRequests, ByteSizeValue.parseBytesSizeValue(maxVolumePerBulkRequest), TimeValue.parseTimeValue(flushInterval, TimeValue.timeValueSeconds(30)));
    ElasticsearchProvider elasticsearchProvider = new ElasticsearchProvider(elasticsearchTransportClient, description);
    return elasticsearchProvider;
}
Example 11
Project: MinecraftForge-master  File: TerminalConsoleAppender.java View source code
@PluginFactory
@Nullable
public static TerminalConsoleAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Filters") Filter filter, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginAttribute("ignoreExceptions") String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for TerminalConsoleAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createLayout(null, null, null, null, null);
    }
    boolean ignoreExceptions = parseBoolean(ignore, true);
    // This is handled by jline
    System.setProperty("log4j.skipJansi", "true");
    return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions);
}
Example 12
Project: splunk-library-javalogging-master  File: HttpEventCollectorLog4jAppender.java View source code
/**
     * Create a Http Appender.
     * @return The Http Appender.
     */
@PluginFactory
public static HttpEventCollectorLog4jAppender createAppender(// @formatter:off
@PluginAttribute("url") final String url, @PluginAttribute("token") final String token, @PluginAttribute("name") final String name, @PluginAttribute("source") final String source, @PluginAttribute("sourcetype") final String sourcetype, @PluginAttribute("host") final String host, @PluginAttribute("index") final String index, @PluginAttribute("ignoreExceptions") final String ignore, @PluginAttribute("batch_size_bytes") final String batchSize, @PluginAttribute("batch_size_count") final String batchCount, @PluginAttribute("batch_interval") final String batchInterval, @PluginAttribute("retries_on_error") final String retriesOnError, @PluginAttribute("send_mode") final String sendMode, @PluginAttribute("middleware") final String middleware, @PluginAttribute("disableCertificateValidation") final String disableCertificateValidation, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter") final Filter filter) {
    if (name == null) {
        LOGGER.error("No name provided for HttpEventCollectorLog4jAppender");
        return null;
    }
    if (url == null) {
        LOGGER.error("No Splunk URL provided for HttpEventCollectorLog4jAppender");
        return null;
    }
    if (token == null) {
        LOGGER.error("No token provided for HttpEventCollectorLog4jAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createLayout("%m", null, null, Charset.forName("UTF-8"), true, false, null, null);
    }
    final boolean ignoreExceptions = true;
    return new HttpEventCollectorLog4jAppender(name, url, token, source, sourcetype, host, index, filter, layout, ignoreExceptions, parseInt(batchInterval, HttpEventCollectorSender.DefaultBatchInterval), parseInt(batchCount, HttpEventCollectorSender.DefaultBatchCount), parseInt(batchSize, HttpEventCollectorSender.DefaultBatchSize), parseInt(retriesOnError, 0), sendMode, middleware, disableCertificateValidation);
}
Example 13
Project: beluga-player-master  File: StatusBarAppender.java View source code
@PluginFactory
public static StatusBarAppender createAppender(@PluginAttribute("name") final String name, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter") Filter filter, @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) final String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for StatusBarAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
    return new StatusBarAppender(name, filter, layout, ignoreExceptions);
}
Example 14
Project: cas-master  File: CloudWatchAppender.java View source code
/**
     * Create appender cloud watch appender.
     *
     * @param name                             the name
     * @param awsLogStreamName                 the aws log stream name
     * @param awsLogGroupName                  the aws log group name
     * @param awsLogStreamFlushPeriodInSeconds the aws log stream flush period in seconds
     * @param credentialAccessKey              the credential access key
     * @param credentialSecretKey              the credential secret key
     * @param awsLogRegionName                 the aws log region name
     * @param layout                           the layout
     * @return the cloud watch appender
     */
@PluginFactory
public static CloudWatchAppender createAppender(@PluginAttribute("name") final String name, @PluginAttribute("awsLogStreamName") final String awsLogStreamName, @PluginAttribute("awsLogGroupName") final String awsLogGroupName, @PluginAttribute("awsLogStreamFlushPeriodInSeconds") final String awsLogStreamFlushPeriodInSeconds, @PluginAttribute("credentialAccessKey") final String credentialAccessKey, @PluginAttribute("credentialSecretKey") final String credentialSecretKey, @PluginAttribute("awsLogRegionName") final String awsLogRegionName, @PluginElement("Layout") final Layout<Serializable> layout) {
    return new CloudWatchAppender(name, awsLogGroupName, awsLogStreamName, awsLogStreamFlushPeriodInSeconds, StringUtils.defaultIfBlank(credentialAccessKey, System.getProperty("AWS_ACCESS_KEY")), StringUtils.defaultIfBlank(credentialSecretKey, System.getProperty("AWS_SECRET_KEY")), StringUtils.defaultIfBlank(awsLogRegionName, System.getProperty("AWS_REGION_NAME")), layout);
}
Example 15
Project: infinispan-master  File: CompressedFileAppender.java View source code
/**
     * Create a File Appender.
     * @param fileName The name and path of the file.
     * @param append "True" if the file should be appended to, "false" if it should be overwritten.
     * The default is "true".
     * @param locking "True" if the file should be locked. The default is "false".
     * @param name The name of the Appender.
     * @param immediateFlush "true" if the contents should be flushed on every write, "false" otherwise. The default
     * is "true".
     * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
     *               they are propagated to the caller.
     * @param bufferedIo "true" if I/O should be buffered, "false" otherwise. The default is "true".
     * @param bufferSizeStr buffer size for buffered IO (default is 8192).
     * @param layout The layout to use to format the event. If no layout is provided the default PatternLayout
     * will be used.
     * @param filter The filter, if any, to use.
     * @param advertise "true" if the appender configuration should be advertised, "false" otherwise.
     * @param advertiseUri The advertised URI which can be used to retrieve the file contents.
     * @param config The Configuration
     * @return The FileAppender.
     */
@PluginFactory
public static CompressedFileAppender createAppender(// @formatter:off
@PluginAttribute("fileName") final String fileName, @PluginAttribute("append") final String append, @PluginAttribute("locking") final String locking, @PluginAttribute("name") final String name, @PluginAttribute("immediateFlush") final String immediateFlush, @PluginAttribute("ignoreExceptions") final String ignore, @PluginAttribute("bufferedIo") final String bufferedIo, @PluginAttribute("bufferSize") final String bufferSizeStr, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter") final Filter filter, @PluginAttribute("advertise") final String advertise, @PluginAttribute("advertiseUri") final String advertiseUri, @PluginConfiguration final Configuration config) {
    // @formatter:on
    final boolean isAppend = Booleans.parseBoolean(append, true);
    final boolean isLocking = Boolean.parseBoolean(locking);
    boolean isBuffered = Booleans.parseBoolean(bufferedIo, true);
    final boolean isAdvertise = Boolean.parseBoolean(advertise);
    if (isLocking && isBuffered) {
        if (bufferedIo != null) {
            LOGGER.warn("Locking and buffering are mutually exclusive. No buffering will occur for " + fileName);
        }
        isBuffered = false;
    }
    final int bufferSize = Integers.parseInt(bufferSizeStr, DEFAULT_BUFFER_SIZE);
    if (!isBuffered && bufferSize > 0) {
        LOGGER.warn("The bufferSize is set to {} but bufferedIO is not true: {}", bufferSize, bufferedIo);
    }
    final boolean isFlush = Booleans.parseBoolean(immediateFlush, true);
    final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
    if (name == null) {
        LOGGER.error("No name provided for FileAppender");
        return null;
    }
    if (fileName == null) {
        LOGGER.error("No filename provided for FileAppender with name " + name);
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    final CompressedFileManager manager = CompressedFileManager.getFileManager(fileName, isAppend, isLocking, isBuffered, advertiseUri, layout, bufferSize);
    if (manager == null) {
        return null;
    }
    return new CompressedFileAppender(name, layout, filter, manager, fileName, ignoreExceptions, isFlush, isAdvertise ? config.getAdvertiser() : null);
}
Example 16
Project: jline-log4j2-appender-master  File: JLineConsoleAppender.java View source code
@PluginFactory
public static JLineConsoleAppender createAppender(@PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") final Filter filter, @PluginAttribute("target") final String t, @PluginAttribute("name") final String name, @PluginAttribute("follow") final String follow, @PluginAttribute("ignoreExceptions") final String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for ConsoleAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.newBuilder().build();
    }
    final boolean isFollow = Boolean.parseBoolean(follow);
    final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
    final Target target = t == null ? Target.SYSTEM_OUT : Target.valueOf(t);
    FactoryData data = new FactoryData(getStream(isFollow, target), layout);
    return new JLineConsoleAppender(name, layout, filter, getManager(isFollow, target, data), getHeldManager(isFollow, target, data), ignoreExceptions);
}
Example 17
Project: NeptuneVanilla-master  File: TerminalConsoleAppender.java View source code
@PluginFactory
public static TerminalConsoleAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Filters") Filter filter, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginAttribute("ignoreExceptions") String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for TerminalConsoleAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createLayout(null, null, null, null, null);
    }
    boolean ignoreExceptions = parseBoolean(ignore, true);
    // This is handled by jline
    System.setProperty("log4j.skipJansi", "true");
    return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions);
}
Example 18
Project: SpongeVanilla-master  File: TerminalConsoleAppender.java View source code
@PluginFactory
public static TerminalConsoleAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Filters") Filter filter, @PluginElement("Layout") @Nullable Layout<? extends Serializable> layout, @PluginAttribute("ignoreExceptions") String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for TerminalConsoleAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createLayout(null, null, null, null, null);
    }
    boolean ignoreExceptions = parseBoolean(ignore, true);
    return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions);
}
Example 19
Project: Torch-master  File: ConsoleAppender.java View source code
/**
     * Create a Console Appender.
     * @param layout The layout to use (required).
     * @param filter The Filter or null.
     * @param t The target ("SYSTEM_OUT" or "SYSTEM_ERR"). The default is "SYSTEM_OUT".
     * @param follow If true will follow changes to the underlying output stream.
     * @param name The name of the Appender (required).
     * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
     *               they are propagated to the caller.
     * @return The ConsoleAppender.
     */
@PluginFactory
public static ConsoleAppender createAppender(@PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") final Filter filter, @PluginAttribute("target") final String t, @PluginAttribute("name") final String name, @PluginAttribute("follow") final String follow, @PluginAttribute("ignoreExceptions") final String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for ConsoleAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createLayout(null, null, null, null, null);
    }
    final boolean isFollow = Boolean.parseBoolean(follow);
    final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
    final Target target = t == null ? Target.SYSTEM_OUT : Target.valueOf(t);
    return new ConsoleAppender(name, layout, filter, getManager(isFollow, target, layout), ignoreExceptions);
}
Example 20
Project: log4j2-gelf-master  File: GelfAppender.java View source code
/**
     * Factory method for creating a {@link GelfTransport} provider within the plugin manager.
     *
     * @param name                             The name of the Appender.
     * @param filter                           A Filter to determine if the event should be handled by this Appender.
     * @param layout                           The Layout to use to format the LogEvent defaults to {@code "%m%n"}.
     * @param ignoreExceptions                 The default is {@code true}, causing exceptions encountered while appending events
     *                                         to be internally logged and then ignored. When set to {@code false} exceptions will
     *                                         be propagated to the caller, instead. Must be set to {@code false} when wrapping this
     *                                         Appender in a {@link org.apache.logging.log4j.core.appender.FailoverAppender}.
     * @param server                           The server name of the GELF server, defaults to {@code localhost}.
     * @param port                             The port the GELF server is listening on, defaults to {@code 12201}.
     * @param hostName                         The host name of the machine generating the logs, defaults to local host name
     *                                         or {@code localhost} if it couldn't be detected.
     * @param protocol                         The transport protocol to use, defaults to {@code UDP}.
     * @param tlsEnabled                       Whether TLS should be enabled, defaults to {@code false}.
     * @param tlsEnableCertificateVerification Whether TLS certificate chain should be checked, defaults to {@code true}.
     * @param tlsTrustCertChainFilename        A X.509 certificate chain file in PEM format for certificate verification, defaults to {@code null}
     * @param queueSize                        The size of the internally used queue, defaults to {@code 512}.
     * @param connectTimeout                   The connection timeout for TCP connections in milliseconds, defaults to {@code 1000}.
     * @param reconnectDelay                   The time to wait between reconnects in milliseconds, defaults to {@code 500}.
     * @param sendBufferSize                   The size of the socket send buffer in bytes, defaults to {@code -1} (deactivate).
     * @param tcpNoDelay                       Whether Nagle's algorithm should be used for TCP connections, defaults to {@code false}.
     * @param tcpKeepAlive                     Whether to try keeping alive TCP connections, defaults to {@code false}.
     * @param includeSource                    Whether the source of the log message should be included, defaults to {@code true}.
     * @param includeThreadContext             Whether the contents of the {@link org.apache.logging.log4j.ThreadContext} should be included, defaults to {@code true}.
     * @param includeStackTrace                Whether a full stack trace should be included, defaults to {@code true}.
     * @param includeExceptionCause            Whether the included stack trace should contain causing exceptions, defaults to {@code false}.
     * @param additionalFields                 Additional static key=value pairs that will be added to every log message.
     * @return a new GELF provider
     */
@PluginFactory
@SuppressWarnings("unused")
public static GelfAppender createGelfAppender(@PluginElement("Filter") Filter filter, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement(value = "AdditionalFields") final KeyValuePair[] additionalFields, @PluginAttribute(value = "name") String name, @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) Boolean ignoreExceptions, @PluginAttribute(value = "server", defaultString = "localhost") String server, @PluginAttribute(value = "port", defaultInt = 12201) Integer port, @PluginAttribute(value = "protocol", defaultString = "UDP") String protocol, @PluginAttribute(value = "hostName") String hostName, @PluginAttribute(value = "queueSize", defaultInt = 512) Integer queueSize, @PluginAttribute(value = "connectTimeout", defaultInt = 1000) Integer connectTimeout, @PluginAttribute(value = "reconnectDelay", defaultInt = 500) Integer reconnectDelay, @PluginAttribute(value = "sendBufferSize", defaultInt = -1) Integer sendBufferSize, @PluginAttribute(value = "tcpNoDelay", defaultBoolean = false) Boolean tcpNoDelay, @PluginAttribute(value = "tcpKeepAlive", defaultBoolean = false) Boolean tcpKeepAlive, @PluginAttribute(value = "includeSource", defaultBoolean = true) Boolean includeSource, @PluginAttribute(value = "includeThreadContext", defaultBoolean = true) Boolean includeThreadContext, @PluginAttribute(value = "includeStackTrace", defaultBoolean = true) Boolean includeStackTrace, @PluginAttribute(value = "includeExceptionCause", defaultBoolean = false) Boolean includeExceptionCause, @PluginAttribute(value = "tlsEnabled", defaultBoolean = false) Boolean tlsEnabled, @PluginAttribute(value = "tlsEnableCertificateVerification", defaultBoolean = true) Boolean tlsEnableCertificateVerification, @PluginAttribute(value = "tlsTrustCertChainFilename") String tlsTrustCertChainFilename) {
    if (name == null) {
        LOGGER.error("No name provided for ConsoleAppender");
        return null;
    }
    if (!"UDP".equalsIgnoreCase(protocol) && !"TCP".equalsIgnoreCase(protocol)) {
        LOG.warn("Invalid protocol {}, falling back to UDP", protocol);
        protocol = "UDP";
    }
    if (hostName == null || hostName.trim().isEmpty()) {
        try {
            final String canonicalHostName = InetAddress.getLocalHost().getCanonicalHostName();
            if (isFQDN(canonicalHostName)) {
                hostName = canonicalHostName;
            } else {
                hostName = InetAddress.getLocalHost().getHostName();
            }
        } catch (UnknownHostException e) {
            LOG.warn("Couldn't detect local host name, falling back to \"localhost\"");
            hostName = "localhost";
        }
    }
    final InetSocketAddress serverAddress = new InetSocketAddress(server, port);
    final GelfTransports gelfProtocol = GelfTransports.valueOf(protocol.toUpperCase());
    final GelfConfiguration gelfConfiguration = new GelfConfiguration(serverAddress).transport(gelfProtocol).queueSize(queueSize).connectTimeout(connectTimeout).reconnectDelay(reconnectDelay).sendBufferSize(sendBufferSize).tcpNoDelay(tcpNoDelay).tcpKeepAlive(tcpKeepAlive);
    if (tlsEnabled) {
        if (gelfProtocol.equals(GelfTransports.TCP)) {
            gelfConfiguration.enableTls();
            if (!tlsEnableCertificateVerification) {
                LOG.warn("TLS certificate validation is disabled. This is unsecure!");
                gelfConfiguration.disableTlsCertVerification();
            }
            if (tlsEnableCertificateVerification && tlsTrustCertChainFilename != null) {
                gelfConfiguration.tlsTrustCertChainFile(new File(tlsTrustCertChainFilename));
            }
        } else {
            LOG.warn("Enabling of TLS is invalid for UDP Transport");
        }
    }
    return new GelfAppender(name, layout, filter, ignoreExceptions, gelfConfiguration, hostName, includeSource, includeThreadContext, includeStackTrace, additionalFields, includeExceptionCause);
}
Example 21
Project: raven-java-master  File: SentryAppender.java View source code
/**
     * Create a Sentry Appender.
     *
     * @param name         The name of the Appender.
     * @param dsn          Data Source Name to access the Sentry server.
     * @param ravenFactory Name of the factory to use to build the {@link Raven} instance.
     * @param release      Release to be sent to Sentry.
     * @param environment  Environment to be sent to Sentry.
     * @param serverName   serverName to be sent to Sentry.
     * @param tags         Tags to add to each event.
     * @param extraTags    Tags to search through the Thread Context Map.
     * @param filter       The filter, if any, to use.
     * @return The SentryAppender.
     */
@PluginFactory
@SuppressWarnings("checkstyle:parameternumber")
public static SentryAppender createAppender(@PluginAttribute("name") final String name, @PluginAttribute("dsn") final String dsn, @PluginAttribute("ravenFactory") final String ravenFactory, @PluginAttribute("release") final String release, @PluginAttribute("environment") final String environment, @PluginAttribute("serverName") final String serverName, @PluginAttribute("tags") final String tags, @PluginAttribute("extraTags") final String extraTags, @PluginElement("filters") final Filter filter) {
    if (name == null) {
        LOGGER.error("No name provided for SentryAppender");
        return null;
    }
    SentryAppender sentryAppender = new SentryAppender(name, filter);
    sentryAppender.setDsn(dsn);
    if (release != null) {
        sentryAppender.setRelease(release);
    }
    if (environment != null) {
        sentryAppender.setEnvironment(environment);
    }
    if (serverName != null) {
        sentryAppender.setServerName(serverName);
    }
    if (tags != null) {
        sentryAppender.setTags(tags);
    }
    if (extraTags != null) {
        sentryAppender.setExtraTags(extraTags);
    }
    sentryAppender.setRavenFactory(ravenFactory);
    return sentryAppender;
}
Example 22
Project: spring-amqp-master  File: AmqpAppender.java View source code
@PluginFactory
public static AmqpAppender createAppender(@PluginConfiguration final Configuration configuration, @PluginAttribute("name") String name, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter") Filter filter, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginAttribute("host") String host, @PluginAttribute("port") int port, @PluginAttribute("addresses") String addresses, @PluginAttribute("user") String user, @PluginAttribute("password") String password, @PluginAttribute("virtualHost") String virtualHost, @PluginAttribute("useSsl") boolean useSsl, @PluginAttribute("sslAlgorithm") String sslAlgorithm, @PluginAttribute("sslPropertiesLocation") String sslPropertiesLocation, @PluginAttribute("keyStore") String keyStore, @PluginAttribute("keyStorePassphrase") String keyStorePassphrase, @PluginAttribute("keyStoreType") String keyStoreType, @PluginAttribute("trustStore") String trustStore, @PluginAttribute("trustStorePassphrase") String trustStorePassphrase, @PluginAttribute("trustStoreType") String trustStoreType, @PluginAttribute("senderPoolSize") int senderPoolSize, @PluginAttribute("maxSenderRetries") int maxSenderRetries, @PluginAttribute("applicationId") String applicationId, @PluginAttribute("routingKeyPattern") String routingKeyPattern, @PluginAttribute("generateId") boolean generateId, @PluginAttribute("deliveryMode") String deliveryMode, @PluginAttribute("exchange") String exchange, @PluginAttribute("exchangeType") String exchangeType, @PluginAttribute("declareExchange") boolean declareExchange, @PluginAttribute("durable") boolean durable, @PluginAttribute("autoDelete") boolean autoDelete, @PluginAttribute("contentType") String contentType, @PluginAttribute("contentEncoding") String contentEncoding, @PluginAttribute("clientConnectionProperties") String clientConnectionProperties, @PluginAttribute("charset") String charset) {
    if (name == null) {
        LOGGER.error("No name for AmqpAppender");
    }
    Layout<? extends Serializable> theLayout = layout;
    if (theLayout == null) {
        theLayout = PatternLayout.createDefaultLayout();
    }
    AmqpManager manager = new AmqpManager(configuration.getLoggerContext(), name);
    manager.host = host;
    manager.port = port;
    manager.addresses = addresses;
    manager.username = user;
    manager.password = password;
    manager.virtualHost = virtualHost;
    manager.useSsl = useSsl;
    manager.sslAlgorithm = sslAlgorithm;
    manager.sslPropertiesLocation = sslPropertiesLocation;
    manager.keyStore = keyStore;
    manager.keyStorePassphrase = keyStorePassphrase;
    manager.keyStoreType = keyStoreType;
    manager.trustStore = trustStore;
    manager.trustStorePassphrase = trustStorePassphrase;
    manager.trustStoreType = trustStoreType;
    manager.senderPoolSize = senderPoolSize;
    manager.maxSenderRetries = maxSenderRetries;
    manager.applicationId = applicationId;
    manager.routingKeyPattern = routingKeyPattern;
    manager.generateId = generateId;
    manager.deliveryMode = MessageDeliveryMode.valueOf(deliveryMode);
    manager.exchangeName = exchange;
    manager.exchangeType = exchangeType;
    manager.declareExchange = declareExchange;
    manager.durable = durable;
    manager.autoDelete = autoDelete;
    manager.contentType = contentType;
    manager.contentEncoding = contentEncoding;
    manager.clientConnectionProperties = clientConnectionProperties;
    manager.charset = charset;
    AmqpAppender appender = new AmqpAppender(name, filter, theLayout, ignoreExceptions, manager);
    if (manager.activateOptions()) {
        appender.startSenders();
        return appender;
    }
    return null;
}
Example 23
Project: jabref-master  File: ApplicationInsightsAppender.java View source code
@PluginFactory
public static ApplicationInsightsAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Filters") Filter filter) {
    return new ApplicationInsightsAppender(name, filter);
}
Example 24
Project: xmlsh-master  File: ShellAppender.java View source code
@PluginFactory
public static ShellAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<?> layout, @PluginElement("Filters") Filter filter) {
    if (name == null) {
        LOGGER.error("No name provided for ShellAppender");
        return null;
    }
    return new ShellAppender(name, filter, layout);
}
Example 25
Project: camel-master  File: LogCaptureAppender.java View source code
@PluginFactory
public static LogCaptureAppender createAppender(@PluginAttribute("name") final String name, @PluginElement("Filter") final Filter filter) {
    return new LogCaptureAppender(name, filter, null);
}
Example 26
Project: geode-master  File: BasicAppender.java View source code
@PluginFactory
public static BasicAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout layout, @PluginElement("Filters") Filter filter) {
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    instance = new BasicAppender(name, filter, layout);
    return instance;
}
Example 27
Project: instrumentation-master  File: InstrumentedAppender.java View source code
@PluginFactory
public static InstrumentedAppender createAppender(@PluginAttribute("name") String name) {
    if (name == null) {
        LOGGER.error("No name provided for InstrumentedAppender");
        return null;
    }
    return new InstrumentedAppender(name);
}
Example 28
Project: jmeter-master  File: GuiLogEventAppender.java View source code
@PluginFactory
public static GuiLogEventAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") Filter filter) {
    if (name == null) {
        LOGGER.error("No name provided for GuiLogEventAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    return new GuiLogEventAppender(name, filter, layout, ignoreExceptions);
}
Example 29
Project: opencmis-master  File: ClientWriterAppender.java View source code
@PluginFactory
public static ClientWriterAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<?> layout, @PluginElement("Filters") Filter filter) {
    if (name == null) {
        LOGGER.error("No name provided for ClientWriterAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    return new ClientWriterAppender(name, filter, (StringLayout) layout);
}
Example 30
Project: org.ops4j.pax.logging-master  File: PaxOsgiAppender.java View source code
/**
     * Create a Pax Osgi Appender.
     * @param name The name of the Appender.
     * @param filter defaults to "*", can be any string that works as a value in {@link org.osgi.framework.Filter}
     * @param config The Configuration
     * @return The FileAppender.
     */
@PluginFactory
public static PaxOsgiAppender createAppender(// @formatter:off
@PluginAttribute("name") final String name, @PluginAttribute("filter") final String filter, @PluginConfiguration final Configuration config) {
    if (name == null) {
        StatusLogger.getLogger().error("No name provided for PaxOsgiAppender");
        return null;
    }
    return new PaxOsgiAppender(name, filter);
}
Example 31
Project: syncope-master  File: MemoryAppender.java View source code
@PluginFactory
public static MemoryAppender createAppender(@PluginAttribute("name") final String name, @PluginAttribute(value = "size", defaultInt = 10) final int size, @PluginElement("Filter") final Filter filter, @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) final boolean ignoreExceptions) {
    return new MemoryAppender(name, size, filter, ignoreExceptions);
}
Example 32
Project: Tank-master  File: DebuggerAppender.java View source code
@PluginFactory
public static DebuggerAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Layout") Layout<?> layout, @PluginElement("Filters") Filter filter, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions) {
    if (name == null) {
        LOGGER.error("No name provided for JTextAreaAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    return new DebuggerAppender(name, layout, filter, ignoreExceptions);
}
Example 33
Project: ApplicationInsights-Java-master  File: ApplicationInsightsAppender.java View source code
/**
     * Creates new appender with the given name and instrumentation key.
     * This method is being called on the application startup upon Log4j system initialization.
     * @param name The appender name.
     * @param instrumentationKey The instrumentation key.
     * @return New Application Insights appender.
     */
@PluginFactory
public static ApplicationInsightsAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("instrumentationKey") String instrumentationKey) {
    return new ApplicationInsightsAppender(name, instrumentationKey);
}
Example 34
Project: metr-master  File: InstrumentedAppender.java View source code
@PluginFactory
public static InstrumentedAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute(value = "registryName", defaultString = "log4j2Metrics") String registry) {
    return new InstrumentedAppender(name, SharedMetricRegistries.getOrCreate(registry));
}
Example 35
Project: metric-master  File: InstrumentedAppender.java View source code
@PluginFactory
public static InstrumentedAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute(value = "registryName", defaultString = "log4j2Metrics") String registry) {
    return new InstrumentedAppender(name, SharedMetricRegistries.getOrCreate(registry));
}
Example 36
Project: metrics-master  File: InstrumentedAppender.java View source code
@PluginFactory
public static InstrumentedAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute(value = "registryName", defaultString = "log4j2Metrics") String registry) {
    return new InstrumentedAppender(name, SharedMetricRegistries.getOrCreate(registry));
}
Example 37
Project: owasp-security-logging-master  File: ExcludeClassifiedMarkerFilter.java View source code
/**
	 * Create a SecurityMarkerFilter.
	 *
	 * @return The created ThresholdFilter.
	 */
@PluginFactory
public static ExcludeClassifiedMarkerFilter createFilter() {
    return new ExcludeClassifiedMarkerFilter();
}
Example 38
Project: SocialDataImporter-master  File: SdiReportAppender.java View source code
/**
     * Factory method called by the log4j initialization framework
     * <p>
     * @param name
     * @param ignoreExceptions
     * @param layout
     * @param filter
     * @return
     */
@PluginFactory
public static SdiReportAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<?> layout, @PluginElement("Filters") Filter filter) {
    if (name == null) {
        LOGGER.error("No name provided for SdiReportAppender");
        return null;
    }
    return new SdiReportAppender(name, null, null);
}
Example 39
Project: spectator-master  File: SpectatorAppender.java View source code
/** Create a new instance of the appender using the global spectator registry. */
@PluginFactory
public static SpectatorAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") Filter filter) {
    if (name == null) {
        LOGGER.error("no name provided for SpectatorAppender");
        return null;
    }
    return new SpectatorAppender(Spectator.globalRegistry(), name, filter, layout, ignoreExceptions);
}
Example 40
Project: cloudwatch-log4j-appender-master  File: CloudWatchAppender.java View source code
@PluginFactory
public static CloudWatchAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("awsLogGroupName") String awsLogGroupName, @PluginAttribute("awsLogStreamName") String awsLogStreamName, @PluginAttribute("awsLogStreamFlushPeriodInSeconds") String awsLogStreamFlushPeriodInSeconds, @PluginElement("Layout") Layout<Serializable> layout) {
    return new CloudWatchAppender(name == null ? DEFAULT_LOG_APPENDER_NAME : name, awsLogGroupName == null ? DEFAULT_AWS_LOG_GROUP_NAME : awsLogGroupName, awsLogStreamName, awsLogStreamFlushPeriodInSeconds, layout);
}
Example 41
Project: log4jna-master  File: Win32EventLogAppender.java View source code
/**
	 * @param name The appender name Win32EventLog
	 * @param server The server for remote logging
	 * @param source The Event View Source
	 * @param application The Event View application (location)
	 * @param eventMessageFile The message file location in the file system
	 * @param categoryMessageFile The message file location in the file system
	 * @param layout A Log4j Layout
	 * @param filter A Log4j Filter
	 * @return
	 */
@PluginFactory
public static Win32EventLogAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("server") String server, @PluginAttribute("source") String source, @PluginAttribute("application") String application, @PluginAttribute("eventMessageFile") String eventMessageFile, @PluginAttribute("categoryMessageFile") String categoryMessageFile, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") Filter filter) {
    return new Win32EventLogAppender(name, server, source, application, eventMessageFile, categoryMessageFile, layout, filter);
}