Refine search
@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); }
@PluginFactory public static LlapWrappedAppender createAppender( @PluginAttribute("name") final String name, // This isn't really used for anything. @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); }
@PluginFactory public static Script createScript( // @formatter:off @PluginAttribute("name") final String name, @PluginAttribute("language") String language, @PluginValue("scriptText") final String scriptText) { // @formatter:on if (language == null) { LOGGER.info("No script language supplied, defaulting to {}", DEFAULT_LANGUAGE); language = DEFAULT_LANGUAGE; } if (scriptText == null) { LOGGER.error("No scriptText attribute provided for ScriptFile {}", name); return null; } return new Script(name, language, scriptText); }
@PluginFactory public static PurgePolicy createPurgePolicy( @PluginAttribute("name") final String name) { // Name required for routing. Error out if it is not set. Preconditions.checkNotNull(name, "Name must be specified for " + LlapRoutingAppenderPurgePolicy.class.getName()); LlapRoutingAppenderPurgePolicy llapRoutingAppenderPurgePolicy = new LlapRoutingAppenderPurgePolicy(name); LlapRoutingAppenderPurgePolicy old = INSTANCES.putIfAbsent(name, llapRoutingAppenderPurgePolicy); if (old != null) { LOGGER.debug("Attempt to create multiple instances of " + LlapRoutingAppenderPurgePolicy.class.getName() + " with the name " + name + ". Using original instance"); llapRoutingAppenderPurgePolicy = old; } return llapRoutingAppenderPurgePolicy; } }
@Required(message = "No name provided for JeroMqAppender") @PluginAttribute("name") final String name, @PluginElement("Layout") Layout<?> layout, @PluginElement("Filter") final Filter filter, @PluginElement("Properties") final Property[] properties, @PluginAttribute("ignoreExceptions") final boolean ignoreExceptions, @PluginAttribute(value = "affinity", defaultLong = 0) final long affinity, @PluginAttribute(value = "backlog", defaultLong = DEFAULT_BACKLOG) final long backlog, @PluginAttribute(value = "delayAttachOnConnect") final boolean delayAttachOnConnect, @PluginAttribute(value = "identity") final byte[] identity, @PluginAttribute(value = "ipv4Only", defaultBoolean = true) final boolean ipv4Only, @PluginAttribute(value = "linger", defaultLong = -1) final long linger, @PluginAttribute(value = "maxMsgSize", defaultLong = -1) final long maxMsgSize, @PluginAttribute(value = "rcvHwm", defaultLong = DEFAULT_RCV_HWM) final long rcvHwm, @PluginAttribute(value = "receiveBufferSize", defaultLong = 0) final long receiveBufferSize, @PluginAttribute(value = "receiveTimeOut", defaultLong = -1) final int receiveTimeOut, @PluginAttribute(value = "reconnectIVL", defaultLong = DEFAULT_IVL) final long reconnectIVL, @PluginAttribute(value = "reconnectIVLMax", defaultLong = 0) final long reconnectIVLMax, @PluginAttribute(value = "sendBufferSize", defaultLong = 0) final long sendBufferSize, @PluginAttribute(value = "sendTimeOut", defaultLong = -1) final int sendTimeOut, @PluginAttribute(value = "sndHwm", defaultLong = DEFAULT_SND_HWM) final long sndHwm, @PluginAttribute(value = "tcpKeepAlive", defaultInt = -1) final int tcpKeepAlive, @PluginAttribute(value = "tcpKeepAliveCount", defaultLong = -1) final long tcpKeepAliveCount, @PluginAttribute(value = "tcpKeepAliveIdle", defaultLong = -1) final long tcpKeepAliveIdle, @PluginAttribute(value = "tcpKeepAliveInterval", defaultLong = -1) final long tcpKeepAliveInterval, @PluginAttribute(value = "xpubVerbose") final boolean xpubVerbose
@PluginFactory public static HiveEventCounter createInstance(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout layout, @PluginElement("Filters") Filter filter) { if (name == null) { name = APPENDER_NAME; } if (layout == null) { layout = PatternLayout.createDefaultLayout(); } return new HiveEventCounter(name, filter, layout, ignoreExceptions); }
@PluginFactory public static NameFilter createFilter( @PluginAttribute("loggingLevel") final String loggingLevel) { // Name required for routing. Error out if it is not set. Preconditions.checkNotNull(loggingLevel, "loggingLevel must be specified for " + NameFilter.class.getName()); return new NameFilter(OperationLog.getLoggingLevel(loggingLevel)); } }
/** * @deprecated Use {@link #newBuilder()} instead */ @Deprecated public static GelfLayout createLayout( //@formatter:off @PluginAttribute("host") final String host, @PluginElement("AdditionalField") final KeyValuePair[] additionalFields, @PluginAttribute(value = "compressionType", defaultString = "GZIP") final CompressionType compressionType, @PluginAttribute(value = "compressionThreshold", defaultInt = COMPRESSION_THRESHOLD) final int compressionThreshold, @PluginAttribute(value = "includeStacktrace", defaultBoolean = true) final boolean includeStacktrace) { // @formatter:on return new GelfLayout(null, host, additionalFields, compressionType, compressionThreshold, includeStacktrace, true, false); }
private Object findDefaultValue(final LogEvent event) { if (this.conversionType == int.class || this.conversionType == Integer.class) { return this.annotation.defaultInt(); return this.annotation.defaultLong(); return this.annotation.defaultBoolean(); return this.annotation.defaultFloat(); return this.annotation.defaultDouble(); return this.annotation.defaultByte(); return this.annotation.defaultChar(); return this.annotation.defaultShort(); return this.annotation.defaultClass(); return this.substitutor.replace(event, this.annotation.defaultString());
@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); }
/** * Creates a ScheduledTriggeringPolicy. * * @param configuration * the Configuration. * @param evaluateOnStartup * check if the file should be rolled over immediately. * @param schedule * the cron expression. * @return a ScheduledTriggeringPolicy. */ @PluginFactory public static CronTriggeringPolicy createPolicy(@PluginConfiguration final Configuration configuration, @PluginAttribute("evaluateOnStartup") final String evaluateOnStartup, @PluginAttribute("schedule") final String schedule) { CronExpression cronExpression; final boolean checkOnStartup = Boolean.parseBoolean(evaluateOnStartup); if (schedule == null) { LOGGER.info("No schedule specified, defaulting to Daily"); cronExpression = getSchedule(defaultSchedule); } else { cronExpression = getSchedule(schedule); if (cronExpression == null) { LOGGER.error("Invalid expression specified. Defaulting to Daily"); cronExpression = getSchedule(defaultSchedule); } } return new CronTriggeringPolicy(cronExpression, checkOnStartup, configuration); }
@PluginFactory public static PurgePolicy createPurgePolicy( @PluginAttribute("name") final String name) { // Name required for routing. Error out if it is not set. Preconditions.checkNotNull(name, "Name must be specified for " + LlapRoutingAppenderPurgePolicy.class.getName()); LlapRoutingAppenderPurgePolicy llapRoutingAppenderPurgePolicy = new LlapRoutingAppenderPurgePolicy(name); LlapRoutingAppenderPurgePolicy old = INSTANCES.putIfAbsent(name, llapRoutingAppenderPurgePolicy); if (old != null) { LOGGER.debug("Attempt to create multiple instances of " + LlapRoutingAppenderPurgePolicy.class.getName() + " with the name " + name + ". Using original instance"); llapRoutingAppenderPurgePolicy = old; } return llapRoutingAppenderPurgePolicy; } }
@PluginFactory public static HiveEventCounter createInstance(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout layout, @PluginElement("Filters") Filter filter) { if (name == null) { name = APPENDER_NAME; } if (layout == null) { layout = PatternLayout.createDefaultLayout(); } return new HiveEventCounter(name, filter, layout, ignoreExceptions); }
@PluginFactory public static CapturingLogAppender createAppender(@PluginAttribute("name") String name) { return new CapturingLogAppender(name, null, null); } }
@PluginFactory public static HushableRandomAccessFileAppender createAppender( @PluginAttribute("fileName") final String fileName, @PluginAttribute("append") final String append, @PluginAttribute("name") final String name, @PluginAttribute("immediateFlush") final String immediateFlush, @PluginAttribute("bufferSize") final String bufferSizeStr, @PluginAttribute("ignoreExceptions") final String ignore, @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) { LOGGER.error("No name provided for FileAppender"); return null; LOGGER.error("No filename provided for FileAppender with name " + name); return null;
@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"); minIndex = Integer.parseInt(min); if (minIndex < 1) { LOGGER.error("Minimum window size too small. Limited to " + MIN_WINDOW_SIZE); minIndex = MIN_WINDOW_SIZE; 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);
@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 HostAndPort createPlugin( @ValidHost(message = "Unit test (host)") @PluginAttribute("host") final String host, @ValidPort(message = "Unit test (port)") @PluginAttribute("port") final int port) { return new HostAndPort(new InetSocketAddress(host, port)); }
@PluginFactory public static ChronicleAppender createAppender( @PluginAttribute("name") final String name, @PluginAttribute("path") final String path, @PluginAttribute("wireType") final String wireType, @PluginElement("chronicleCfg") final ChronicleCfg chronicleConfig, @PluginElement("filter") final Filter filter) { if (name == null) { LOGGER.error("No name provided for ChronicleAppender"); return null; } if (path == null) { LOGGER.error("No path provided for ChronicleAppender"); return null; } return new ChronicleAppender(name, filter, path, wireType, chronicleConfig); }
@PluginFactory public static LookupFilter createFilter( @PluginAttribute("key") final String key, @PluginAttribute("value") final String value, @PluginAttribute("onMatch") final Result match, @PluginAttribute("onMismatch") final Result mismatch) { if (key == null) { LOGGER.error("LookupFilter name attribute is required"); return null; } if (value == null) { LOGGER.error("LookupFilter value attribute is required"); return null; } return new LookupFilter(key, value, match, mismatch); } }