类org.apache.logging.log4j.core.config.plugins.PluginAttribute源码实例Demo

下面列出了怎么用org.apache.logging.log4j.core.config.plugins.PluginAttribute的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: vividus   文件: AllureLogAppender.java
@PluginFactory
public static AllureLogAppender createAppender(@PluginAttribute("name") final String name,
        @PluginElement("Filter") Filter filter, @PluginElement("Layout") Layout<? extends Serializable> layout)
{
    if (name == null)
    {
        LOGGER.error("No name provided for AllureLogAppender");
        instance = null;
    }
    else
    {
        instance = new AllureLogAppender(name, filter, layout);
    }

    return instance;
}
 
源代码2 项目: patchwork-patcher   文件: UIAppender.java
@SuppressWarnings("unused")
@PluginFactory
public static UIAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("maxLines") int maxLines,
			@PluginAttribute("ignoreExceptions") boolean ignoreExceptions,
			@PluginElement("Layout") Layout<?> layout, @PluginElement("Filters") Filter filter) {
	if (name == null) {
		LOGGER.error("No name provided for UIAppender");
		return null;
	}

	if (layout == null) {
		layout = JsonLayout.createDefaultLayout();
	}

	return new UIAppender(name, layout, filter, maxLines, ignoreExceptions);
}
 
源代码3 项目: summerframework   文件: CustomJsonLayout.java
@PluginFactory
public static CustomJsonLayout createLayout(@PluginConfiguration final Configuration config,
    @PluginAttribute(value = "locationInfo", defaultBoolean = false) final boolean locationInfo,
    @PluginAttribute(value = "properties", defaultBoolean = false) final boolean properties,
    @PluginAttribute(value = "propertiesAsList", defaultBoolean = false) final boolean propertiesAsList,
    @PluginAttribute(value = "complete", defaultBoolean = false) final boolean complete,
    @PluginAttribute(value = "compact", defaultBoolean = false) final boolean compact,
    @PluginAttribute(value = "eventEol", defaultBoolean = false) final boolean eventEol,
    @PluginAttribute(value = "header", defaultString = DEFAULT_HEADER) final String headerPattern,
    @PluginAttribute(value = "footer", defaultString = DEFAULT_FOOTER) final String footerPattern,
    @PluginAttribute(value = "charset", defaultString = "UTF-8") final Charset charset,
    @PluginAttribute(value = "includeStacktrace", defaultBoolean = true) final boolean includeStacktrace,
    @PluginAttribute(value = "stacktraceAsString", defaultBoolean = false) final boolean stacktraceAsString,
    @PluginAttribute(value = "objectMessageAsJsonObject",
        defaultBoolean = false) final boolean objectMessageAsJsonObject) {
    final boolean encodeThreadContextAsList = properties && propertiesAsList;
    return new CustomJsonLayout(config, locationInfo, properties, encodeThreadContextAsList, complete, compact,
        eventEol, headerPattern, footerPattern, charset, includeStacktrace, stacktraceAsString,
        objectMessageAsJsonObject);
}
 
源代码4 项目: GreenSummer   文件: InMemoryAppenderImpl.java
/**
 * Creates the appender.
 *
 * @param name the name
 * @param layout the layout
 * @param filter the filter
 * @param size the size
 * @return the in memory appender impl
 */
// the configured attributes.
@PluginFactory
public static InMemoryAppenderImpl createAppender(@PluginAttribute("name") String name,
    @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter")
    final Filter filter, @PluginAttribute("size") int size) {
    Layout<? extends Serializable> layoutAux = layout;
    if (name == null) {
        LOGGER.error("No name provided for InMemoryAppenderImpl");
        return null;
    }
    if (layoutAux == null) {
        layoutAux = PatternLayout.createDefaultLayout();
    }
    return new InMemoryAppenderImpl(name, filter, layoutAux, true, size);
}
 
源代码5 项目: Thermos   文件: ConsoleAppender.java
/**
 * 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);
}
 
源代码6 项目: jesterj   文件: JesterJAppender.java
@PluginFactory
public static JesterJAppender 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 JesterJAppender");
    return null;
  }

  manager = createManager();
  if (manager == null) {
    return null; // should never happen
  }
  if (layout == null) {
    layout = PatternLayout.createDefaultLayout();
  }
  cassandra.addStatement(FTI_INSERT_Q, INSERT_FTI);
  cassandra.addStatement(REG_INSERT_Q, INSERT_REG);
  return new JesterJAppender(name, layout, filter, manager, ignoreExceptions);
}
 
源代码7 项目: spectator   文件: SpectatorAppender.java
/** 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,
      Property.EMPTY_ARRAY);
}
 
源代码8 项目: logging-log4j2   文件: TimeFilter.java
/**
 * Creates a TimeFilter.
 * @param start The start time.
 * @param end The end time.
 * @param tz timezone.
 * @param match Action to perform if the time matches.
 * @param mismatch Action to perform if the action does not match.
 * @return A TimeFilter.
 */
// TODO Consider refactoring to use AbstractFilter.AbstractFilterBuilder
@PluginFactory
public static TimeFilter createFilter(
        @PluginAttribute("start") final String start,
        @PluginAttribute("end") final String end,
        @PluginAttribute("timezone") final String tz,
        @PluginAttribute("onMatch") final Result match,
        @PluginAttribute("onMismatch") final Result mismatch) {
    final LocalTime startTime = parseTimestamp(start, LocalTime.MIN);
    final LocalTime endTime = parseTimestamp(end, LocalTime.MAX);
    final ZoneId timeZone = tz == null ? ZoneId.systemDefault() : ZoneId.of(tz);
    final Result onMatch = match == null ? Result.NEUTRAL : match;
    final Result onMismatch = mismatch == null ? Result.DENY : mismatch;
    return new TimeFilter(startTime, endTime, timeZone, onMatch, onMismatch);
}
 
源代码9 项目: molicode   文件: FrontConsoleAppender.java
@PluginFactory
public static FrontConsoleAppender createAppender(@PluginAttribute("name") String name,
                                                  @PluginAttribute("fileName") String fileName,
                                                  @PluginElement("Filter") final Filter filter,
                                                  @PluginElement("Layout") Layout<? extends Serializable> layout,
                                                  @PluginAttribute("ignoreExceptions") boolean ignoreExceptions) {
    if (name == null) {
        LOGGER.error("no name defined in conf.");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    return new FrontConsoleAppender(name, filter, layout, ignoreExceptions, fileName);
}
 
源代码10 项目: summerframework   文件: AdvancedKafkaAppender.java
@PluginFactory
public static AdvancedKafkaAppender createAppender(
    @PluginElement("Layout") final Layout<? extends Serializable> layout,
    @PluginElement("Filter") final Filter filter, //
    @PluginConfiguration final Configuration configuration,
    @Required(message = "No name provided for KafkaAppender") @PluginAttribute("name") final String name,
    @Required(message = "No topic provided for KafkaAppender") @PluginAttribute("topic") final String topic,
    @Required(
        message = "No bootstrapServers provided for KafkaAppender") @PluginAttribute("bootstrapServers") final String bootstrapServers) {
    final AdvancedKafkaManager advancedKafkaManager =
        new AdvancedKafkaManager(configuration.getLoggerContext(), name, bootstrapServers);
    return new AdvancedKafkaAppender(name, layout, filter, false, advancedKafkaManager, topic);
}
 
源代码11 项目: xian   文件: GelfDynamicMdcLogFields.java
@PluginFactory
public static GelfDynamicMdcLogFields createField(@PluginConfiguration final Configuration config,
        @PluginAttribute("regex") String regex) {

    if (Strings.isEmpty(regex)) {
        LOGGER.error("The regex is empty");
        return null;
    }

    return new GelfDynamicMdcLogFields(regex);
}
 
源代码12 项目: xian   文件: GelfLogField.java
@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);
}
 
/**
 * Creates a new {@link TerminalConsoleAppender}.
 *
 * @param name The name of the appender
 * @param filter The filter, can be {@code null}
 * @param layout The layout, can be {@code null}
 * @param ignoreExceptions If {@code true} exceptions encountered when
 *     appending events are logged, otherwise they are propagated to the
 *     caller
 * @return The new appender
 */
@PluginFactory
public static TerminalConsoleAppender createAppender(
        @Required(message = "No name provided for TerminalConsoleAppender") @PluginAttribute("name") String name,
        @PluginElement("Filter") Filter filter,
        @PluginElement("Layout") @Nullable Layout<? extends Serializable> layout,
        @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) boolean ignoreExceptions) {

    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }

    return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions);
}
 
@PluginFactory
public static CustomMdcKeyElement createCustomMdcKey(@PluginAttribute("key") final String key) {
    if (Strings.isEmpty(key)) {
        LOGGER.error("customMdcKey needs a key and cannot be empty.");
        return null;
    }
    return new CustomMdcKeyElement(key);
}
 
源代码15 项目: ModPackDownloader   文件: TextAreaAppender.java
/**
 * Factory method. Log4j will parse the configuration and call this factory
 * method to construct the appender with
 * the configured attributes.
 *
 * @param name   Name of appender
 * @param layout Log layout of appender
 * @param filter Filter for appender
 * @return The TextAreaAppender
 */
@PluginFactory
public static TextAreaAppender createAppender(
		@PluginAttribute("name") String name,
		@PluginElement("Layout") Layout<? extends Serializable> layout,
		@PluginElement("Filter") final Filter filter) {
	if (name == null) {
		LOGGER.error("No name provided for TextAreaAppender");
		return null;
	}
	if (layout == null) {
		layout = PatternLayout.createDefaultLayout();
	}
	return new TextAreaAppender(name, filter, layout, true);
}
 
源代码16 项目: Zebra   文件: ZebraRolloverStrategy.java
/**
 * Create the DefaultRolloverStrategy.
 * @param max The maximum number of files to keep.
 * @param min The minimum number of files to keep.
 * @param fileIndex If set to "max" (the default), files with a higher index will be newer than files with a
 * smaller index. If set to "min", file renaming and the counter will follow the Fixed Window strategy.
 * @param compressionLevelStr The compression level, 0 (less) through 9 (more); applies only to ZIP files.
 * @param config The Configuration.
 * @return A DefaultRolloverStrategy.
 */
@PluginFactory
public static ZebraRolloverStrategy createStrategy(
        @PluginAttribute("max") final String max,
        @PluginAttribute("min") final String min,
        @PluginAttribute("fileIndex") final String fileIndex,
        @PluginAttribute("compressionLevel") final String compressionLevelStr,
        @PluginConfiguration final Configuration config) {
    final boolean useMax = fileIndex == null ? true : fileIndex.equalsIgnoreCase("max");
    int minIndex = MIN_WINDOW_SIZE;
    if (min != null) {
        minIndex = Integer.parseInt(min);
        if (minIndex < 1) {
            LOGGER.error("Minimum window size too small. Limited to " + MIN_WINDOW_SIZE);
            minIndex = MIN_WINDOW_SIZE;
        }
    }
    int maxIndex = DEFAULT_WINDOW_SIZE;
    if (max != null) {
        maxIndex = Integer.parseInt(max);
        if (maxIndex < minIndex) {
            maxIndex = minIndex < DEFAULT_WINDOW_SIZE ? DEFAULT_WINDOW_SIZE : minIndex;
            LOGGER.error("Maximum window size must be greater than the minimum windows size. Set to " + maxIndex);
        }
    }
    final int compressionLevel = Integers.parseInt(compressionLevelStr, Deflater.DEFAULT_COMPRESSION);
    return new ZebraRolloverStrategy(minIndex, maxIndex, useMax, compressionLevel, config.getStrSubstitutor());
}
 
源代码17 项目: samza   文件: StreamAppender.java
@PluginFactory
public static StreamAppender createAppender(
    @PluginAttribute("name") final String name,
    @PluginElement("Filter") final Filter filter,
    @PluginElement("Layout") Layout layout,
    @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) final boolean ignoreExceptions,
    @PluginAttribute("streamName") String streamName) {
  return new StreamAppender(name, filter, layout, ignoreExceptions, streamName);
}
 
源代码18 项目: samza   文件: MockSystemProducerAppender.java
@PluginFactory
public static MockSystemProducerAppender createAppender(
    @PluginAttribute("name") final String name,
    @PluginElement("Filter") final Filter filter,
    @PluginElement("Layout") Layout<? extends Serializable> layout,
    @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) final boolean ignoreExceptions,
    @PluginElement("Config") final Config testConfig,
    @PluginAttribute("streamName") String streamName) {
  if (testConfig == null) {
    initConfig();
  } else {
    config = testConfig;
  }
  return new MockSystemProducerAppender(name, filter, layout, ignoreExceptions, config, streamName);
}
 
源代码19 项目: rollbar-java   文件: RollbarAppender.java
/**
 * Create appender plugin factory method.
 *
 * @param accessToken the Rollbar access token.
 * @param codeVersion the codeVersion.
 * @param endpoint the Rollbar endpoint to be used.
 * @param environment the environment.
 * @param language the language.
 * @param enabled to enable or disable Rollbar.
 * @param configProviderClassName The class name of the config provider implementation to get
 *     the configuration.
 * @param name the name.
 * @param layout the layout.
 * @param filter the filter.
 * @param ignore the ignore exceptions flag.
 * @return the rollbar appender.
 */
@PluginFactory
public static RollbarAppender createAppender(
    @PluginAttribute("accessToken") @Required final String accessToken,
    @PluginAttribute("codeVersion") final String codeVersion,
    @PluginAttribute("endpoint") final String endpoint,
    @PluginAttribute("environment") final String environment,
    @PluginAttribute("language") final String language,
    @PluginAttribute("enabled") final boolean enabled,
    @PluginAttribute("configProviderClassName") final String configProviderClassName,
    @PluginAttribute("name") @Required final String name,
    @PluginElement("Layout") Layout<? extends Serializable> layout,
    @PluginElement("Filter") Filter filter,
    @PluginAttribute("ignoreExceptions") final String ignore
) {

  ConfigProvider configProvider = ConfigProviderHelper
      .getConfigProvider(configProviderClassName);
  Config config;

  ConfigBuilder configBuilder = withAccessToken(accessToken)
      .codeVersion(codeVersion)
      .environment(environment)
      .endpoint(endpoint)
      .server(new ServerProvider())
      .language(language)
      .enabled(enabled);

  if (configProvider != null) {
    config = configProvider.provide(configBuilder);
  } else {
    config = configBuilder.build();
  }

  Rollbar rollbar = new Rollbar(config);

  boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);

  return new RollbarAppender(name, filter, layout, ignoreExceptions, rollbar);
}
 
源代码20 项目: syncope   文件: MemoryAppender.java
@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);
}
 
源代码21 项目: Flashtool   文件: TextAreaAppender.java
/**
 * Factory method. Log4j will parse the configuration and call this factory 
 * method to construct the appender with
 * the configured attributes.
 *
 * @param name   Name of appender
 * @param layout Log layout of appender
 * @param filter Filter for appender
 * @return The TextAreaAppender
 */
@PluginFactory
public static TextAreaAppender createAppender(
    @PluginAttribute("name") String name,
    @PluginElement("Layout") Layout<? extends Serializable> layout,
    @PluginElement("Filter") final Filter filter) {
  if (name == null) {
    LOGGER.error("No name provided for TextAreaAppender2");
    return null;
  }
  if (layout == null) {
    layout = PatternLayout.createDefaultLayout();
  }
  return new TextAreaAppender(name, filter, layout, true);
}
 
源代码22 项目: Flashtool   文件: ConsoleAppender.java
/**
 * Factory method. Log4j will parse the configuration and call this factory 
 * method to construct the appender with
 * the configured attributes.
 *
 * @param name   Name of appender
 * @param layout Log layout of appender
 * @param filter Filter for appender
 * @return The TextAreaAppender
 */
@PluginFactory
public static ConsoleAppender createAppender(
    @PluginAttribute("name") String name,
    @PluginElement("Layout") Layout<? extends Serializable> layout,
    @PluginElement("Filter") final Filter filter) {
  if (name == null) {
    LOGGER.error("No name provided for TextAreaAppender2");
    return null;
  }
  if (layout == null) {
    layout = PatternLayout.createDefaultLayout();
  }
  return new ConsoleAppender(name, filter, layout, true);
}
 
源代码23 项目: Flashtool   文件: StringBuilderAppender.java
/**
 * Factory method. Log4j will parse the configuration and call this factory 
 * method to construct the appender with
 * the configured attributes.
 *
 * @param name   Name of appender
 * @param layout Log layout of appender
 * @param filter Filter for appender
 * @return The TextAreaAppender
 */
@PluginFactory
public static StringBuilderAppender createAppender(
    @PluginAttribute("name") String name,
    @PluginElement("Layout") Layout<? extends Serializable> layout,
    @PluginElement("Filter") final Filter filter) {
  if (name == null) {
    LOGGER.error("No name provided for TextAreaAppender2");
    return null;
  }
  if (layout == null) {
    layout = PatternLayout.createDefaultLayout();
  }
  return new StringBuilderAppender(name, filter, layout, true);
}
 
@PluginFactory
public static SystemdJournalAppender createAppender(@PluginAttribute("name") final String name,
        @PluginAttribute("ignoreExceptions") final String ignoreExceptionsString,
        @PluginAttribute("logSource") final String logSourceString,
        @PluginAttribute("logStacktrace") final String logStacktraceString,
        @PluginAttribute("logLoggerName") final String logLoggerNameString,
        @PluginAttribute("logAppenderName") final String logAppenderNameString,
        @PluginAttribute("logThreadName") final String logThreadNameString,
        @PluginAttribute("logThreadContext") final String logThreadContextString,
        @PluginAttribute("threadContextPrefix") final String threadContextPrefix,
        @PluginAttribute("syslogIdentifier") final String syslogIdentifier,
        @PluginAttribute("syslogFacility") final String syslogFacility,
        @PluginElement("Layout") final Layout<?> layout,
        @PluginElement("Filter") final Filter filter,
        @PluginConfiguration final Configuration config) {
    final boolean ignoreExceptions = Booleans.parseBoolean(ignoreExceptionsString, true);
    final boolean logSource = Booleans.parseBoolean(logSourceString, false);
    final boolean logStacktrace = Booleans.parseBoolean(logStacktraceString, true);
    final boolean logThreadName = Booleans.parseBoolean(logThreadNameString, true);
    final boolean logLoggerName = Booleans.parseBoolean(logLoggerNameString, true);
    final boolean logAppenderName = Booleans.parseBoolean(logAppenderNameString, true);
    final boolean logThreadContext = Booleans.parseBoolean(logThreadContextString, true);

    if (name == null) {
        LOGGER.error("No name provided for SystemdJournalAppender");
        return null;
    }

    final SystemdJournalLibrary journalLibrary;
    try {
        journalLibrary = Native.loadLibrary("systemd", SystemdJournalLibrary.class);
    } catch (UnsatisfiedLinkError e) {
        throw new RuntimeException("Failed to load systemd library." +
            " Please note that JNA requires an executable temporary folder." +
            " It can be explicitly defined with -Djna.tmpdir", e);
    }

    return new SystemdJournalAppender(name, filter, layout, ignoreExceptions, journalLibrary, logSource, logStacktrace,
            logThreadName, logLoggerName, logAppenderName, logThreadContext, threadContextPrefix, syslogIdentifier, syslogFacility);
}
 
源代码25 项目: client_java   文件: InstrumentedAppender.java
@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);
}
 
源代码26 项目: iaf   文件: IbisXmlLayout.java
@PluginFactory
public static IbisXmlLayout createLayout(
		@PluginConfiguration final Configuration config,
		// LOG4J2-783 use platform default by default, so do not specify defaultString for charset
		@PluginAttribute(value = "charset") final Charset charset,
		@PluginAttribute(value = "alwaysWriteExceptions", defaultBoolean = true) final boolean alwaysWriteExceptions) {
	return new IbisXmlLayout(config, charset, alwaysWriteExceptions);
}
 
源代码27 项目: iaf   文件: IbisPatternLayout.java
@PluginFactory
public static IbisPatternLayout createLayout(
		@PluginAttribute(value = "pattern", defaultString = IbisPatternLayout.DEFAULT_PATTERN) final String pattern,
		@PluginConfiguration final Configuration config,
		// LOG4J2-783 use platform default by default, so do not specify defaultString for charset
		@PluginAttribute(value = "charset") final Charset charset,
		@PluginAttribute(value = "alwaysWriteExceptions", defaultBoolean = true) final boolean alwaysWriteExceptions,
		@PluginAttribute(value = "noConsoleNoAnsi") final boolean noConsoleNoAnsi,
		@PluginAttribute(value = "disableAnsi") final boolean disableAnsi) {
	return new IbisPatternLayout(config, pattern, charset, alwaysWriteExceptions, disableAnsi, noConsoleNoAnsi);
}
 
源代码28 项目: iaf   文件: IbisThreadFilter.java
@PluginFactory
public static IbisThreadFilter createFilter(@PluginAttribute(value = "regex") String regex,
											@PluginAttribute(value = "level", defaultString = "WARN") Level level,
											@PluginAttribute(value = "onMatch", defaultString = "DENY") Result onMatch,
											@PluginAttribute(value = "onMismatch", defaultString = "NEUTRAL") Result onMismatch) {
	return new IbisThreadFilter(level, regex, onMatch, onMismatch);
}
 
源代码29 项目: engine   文件: ThreadContextKeyExistsFilter.java
@PluginFactory
public static ThreadContextKeyExistsFilter createFilter(
    @PluginAttribute(value = "key") String key,
    @PluginAttribute(value = "acceptIfKeyExists") boolean acceptIfKeyExists,
    @PluginAttribute(value = "denyIfKeyDoesNotExist") boolean denyIfKeyDoesNotExist) {
    ThreadContextKeyExistsFilter filter = new ThreadContextKeyExistsFilter();
    filter.setKey(key);
    filter.setAcceptIfKeyExists(acceptIfKeyExists);
    filter.setDenyIfKeyDoesNotExist(denyIfKeyDoesNotExist);
    return filter;
}
 
源代码30 项目: engine   文件: CircularQueueLogAppender.java
@PluginFactory
public static CircularQueueLogAppender createAppender(
    @PluginAttribute(value = "name") String name,
    @PluginElement(value = "Filters") Filter filter,
    @PluginElement(value = "Layout") Layout<? extends Serializable> layout,
    @PluginAttribute(value = "ignoreExceptions") boolean ignoreExceptions,
    @PluginAttribute(value = "maxQueueSize") int maxQueueSize,
    @PluginAttribute(value = "dateFormat") String dateFormat,
    @PluginAttribute(value = "global") boolean global) {

    if (StringUtils.isEmpty(name)) {
        LOGGER.error("No name provided for " + PLUGIN_NAME);
        return null;
    }

    if (Objects.isNull(layout)) {
        layout = PatternLayout.createDefaultLayout();
    }

    if (Objects.isNull(buffer)) {
        LOGGER.debug("Initializing circular log queue buffer");
        if (maxQueueSize <= 0) {
            throw new IllegalArgumentException("maxQueueSize must be a integer bigger that 0");
        }
        buffer = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(maxQueueSize));
    }

    CircularQueueLogAppender appender = new CircularQueueLogAppender(name, filter, layout, ignoreExceptions, null);
    appender.dateFormat = DateTimeFormatter.ofPattern(dateFormat).withZone(ZoneId.of("UTC"));
    appender.global = global;

    return appender;
}
 
 类所在包
 同包方法