/** * Factory method to create a LoggerConfig. * * @param additivity true if additive, false otherwise. * @param level The Level to be associated with the Logger. * @param loggerName The name of the Logger. * @param includeLocation whether location should be passed downstream * @param refs An array of Appender names. * @param properties Properties to pass to the Logger. * @param config The Configuration. * @param filter A Filter. * @return A new LoggerConfig. * @since 2.6 */ @PluginFactory public static LoggerConfig createLogger( // @formatter:off @PluginAttribute(value = "additivity", defaultBoolean = true) final boolean additivity, @PluginAttribute("level") final Level level, @Required(message = "Loggers cannot be configured without a name") @PluginAttribute("name") final String loggerName, @PluginAttribute("includeLocation") final String includeLocation, @PluginElement("AppenderRef") final AppenderRef[] refs, @PluginElement("Properties") final Property[] properties, @PluginConfiguration final Configuration config, @PluginElement("Filter") final Filter filter // @formatter:on ) { final String name = loggerName.equals(ROOT) ? Strings.EMPTY : loggerName; return new LoggerConfig(name, Arrays.asList(refs), filter, level, additivity, properties, config, includeLocation(includeLocation)); }
@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); }
/** * Factory for log4j2 * * @param name of the appender * @param filter for the appender * @param layout for the appender * @param ignoreExceptions controls if we should display exceptions * @return new jline terminal 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 ) { Layout<? extends Serializable> finalLayout = layout; if ( layout == null ) { finalLayout = PatternLayout.createDefaultLayout(); } return new TerminalConsoleAppender( name, filter, finalLayout, ignoreExceptions ); }
@PluginFactory public static UsesLoggingAppender createAppender( @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name, @PluginAttribute("ignoreExceptions") final boolean ignore, @PluginElement("Layout") final Layout<?> layout, @PluginElement("Filter") final Filter filter) { return new UsesLoggingAppender(name, filter, layout, ignore); }
@PluginFactory public static HangingAppender createAppender( @PluginAttribute("name") @Required(message = "No name provided for HangingAppender") final String name, @PluginAttribute("delay") final long delay, @PluginAttribute("startupDelay") final long startupDelay, @PluginAttribute("shutdownDelay") final long shutdownDelay, @PluginElement("Layout") final Layout<? extends Serializable> layout, @PluginElement("Filter") final Filter filter) { return new HangingAppender(name, delay, startupDelay, shutdownDelay); }
@PluginFactory public static BlockingAppender createAppender( @PluginAttribute("name") @Required(message = "No name provided for HangingAppender") final String name, @PluginElement("Layout") final Layout<? extends Serializable> layout, @PluginElement("Filter") final Filter filter) { return new BlockingAppender(name); }
@Override public void initialize(final Required anAnnotation) { this.annotation = anAnnotation; }
@PluginFactory public static BlockingAppender createAppender( @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) { return new BlockingAppender(name); }
@PluginFactory public static AlwaysFailAppender createAppender( @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) { return new AlwaysFailAppender(name); }
@PluginFactory public static FailOnceAppender createAppender( @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) { return new FailOnceAppender(name); }
@PluginFactory public static DeadlockAppender createAppender( @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) { return new DeadlockAppender(name); }
@PluginFactory public static ValidatingPluginWithGenericBuilder newValidatingPlugin( @Required(message = "The name given by the factory is null") final String name) { return new ValidatingPluginWithGenericBuilder(name); }
@PluginFactory public static ValidatingPlugin newValidatingPlugin( @Required(message = "The name given by the factory is null") final String name) { return new ValidatingPlugin(name); }
@PluginFactory public static ValidatingPluginWithTypedBuilder newValidatingPlugin( @Required(message = "The name given by the factory is null") final String name) { return new ValidatingPluginWithTypedBuilder(name); }