org.apache.logging.log4j.core.config.plugins.validation.constraints.Required Java Examples
The following examples show how to use
org.apache.logging.log4j.core.config.plugins.validation.constraints.Required.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdvancedKafkaAppender.java From summerframework with Apache License 2.0 | 5 votes |
@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); }
Example #2
Source File: TerminalConsoleAppender.java From TerminalConsoleAppender with MIT License | 5 votes |
/** * 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); }
Example #3
Source File: KafkaAppender.java From SkyEye with GNU General Public License v3.0 | 5 votes |
@PluginFactory public static KafkaAppender createAppender( @PluginElement("Layout") final Layout<? extends Serializable> layout, @PluginElement("Filter") final Filter filter, @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 zkServers provided for KafkaAppender") @PluginAttribute("zkServers") final String zkServers, @Required(message = "No mail provided for KafkaAppender") @PluginAttribute("mail") final String mail, @Required(message = "No rpc provided for KafkaAppender") @PluginAttribute("rpc") final String rpc, @Required(message = "No app provided for KafkaAppender") @PluginAttribute("app") final String app, @PluginElement("Properties") final Property[] properties, @PluginConfiguration final Configuration configuration) { final KafkaManager kafkaManager = new KafkaManager(configuration.getLoggerContext(), name, topic, zkServers, mail, rpc, app, SysUtil.host, properties); return new KafkaAppender(name, layout, filter, kafkaManager); }
Example #4
Source File: RollbarAppender.java From rollbar-java with MIT License | 5 votes |
/** * 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); }
Example #5
Source File: LoggerNamePatternSelector.java From TerminalConsoleAppender with MIT License | 3 votes |
/** * Creates a new {@link LoggerNamePatternSelector}. * * @param defaultPattern The default pattern to use if no logger name matches * @param properties The pattern match rules to use * @param alwaysWriteExceptions Write exceptions even if pattern does not * include exception conversion * @param disableAnsi If true, disable all ANSI escape codes * @param noConsoleNoAnsi If true and {@link System#console()} is null, * disable ANSI escape codes * @param config The configuration * @return The new pattern selector */ @PluginFactory public static LoggerNamePatternSelector createSelector( @Required(message = "Default pattern is required") @PluginAttribute(value = "defaultPattern") String defaultPattern, @PluginElement("PatternMatch") PatternMatch[] properties, @PluginAttribute(value = "alwaysWriteExceptions", defaultBoolean = true) boolean alwaysWriteExceptions, @PluginAttribute("disableAnsi") boolean disableAnsi, @PluginAttribute("noConsoleNoAnsi") boolean noConsoleNoAnsi, @PluginConfiguration Configuration config) { return new LoggerNamePatternSelector(defaultPattern, properties, alwaysWriteExceptions, disableAnsi, noConsoleNoAnsi, config); }