当前位置: 首页>>代码示例>>Java>>正文


Java PluginAttribute类代码示例

本文整理汇总了Java中org.apache.logging.log4j.core.config.plugins.PluginAttribute的典型用法代码示例。如果您正苦于以下问题:Java PluginAttribute类的具体用法?Java PluginAttribute怎么用?Java PluginAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PluginAttribute类属于org.apache.logging.log4j.core.config.plugins包,在下文中一共展示了PluginAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:33,代码来源:CloudWatchAppender.java

示例2: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:32,代码来源:ConsoleAppender.java

示例3: createLayout

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
/**
 * Creates the layout.
 *
 * @param locationInfo the location info
 * @param singleLine the single line
 * @param htmlSafe the html safe
 * @param plainContextMap the plain context map
 * @param charset the charset
 * @param userFields the user fields
 * @return the JSON log 4 j 2 layout
 */
@PluginFactory
public static JSONLog4j2Layout createLayout(
	// @formatter:off
		@PluginConfiguration final Configuration config,
		@PluginAttribute("locationInfo") boolean locationInfo,
		@PluginAttribute("singleLine") boolean singleLine,
		@PluginAttribute("htmlSafe") boolean htmlSafe,
		@PluginAttribute("plainContextMap") boolean plainContextMap, 
		@PluginAttribute("charset") Charset charset,
		@PluginElement("UserFields") final UserField[] userFields
	// @formatter:on
	) {
	
	if(charset == null){
		charset = Charset.forName("UTF-8");
	}
	
	LOGGER.debug("Creating JSONLog4j2Layout {}",charset);
    return new JSONLog4j2Layout(locationInfo, singleLine, htmlSafe, plainContextMap, userFields, charset);
}
 
开发者ID:dubasdey,项目名称:log4j2-jsonevent-layout,代码行数:32,代码来源:JSONLog4j2Layout.java

示例4: createFluencyConfig

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@PluginFactory
public static FluencyConfig createFluencyConfig(
        @PluginAttribute("ackResponseMode") final boolean ackResponseMode,
        @PluginAttribute("fileBackupDir") final String fileBackupDir,
        @PluginAttribute("bufferChunkInitialSize") final int bufferChunkInitialSize,
        @PluginAttribute("bufferChunkRetentionSize") final int bufferChunkRetentionSize,
        @PluginAttribute("maxBufferSize") final Long maxBufferSize,
        @PluginAttribute("waitUntilBufferFlushed") final int waitUntilBufferFlushed,
        @PluginAttribute("waitUntilFlusherTerminated") final int waitUntilFlusherTerminated,
        @PluginAttribute("flushIntervalMillis") final int flushIntervalMillis,
        @PluginAttribute("senderMaxRetryCount") final int senderMaxRetryCount) {
    FluencyConfig config = new FluencyConfig();
    config.ackResponseMode = ackResponseMode;
    config.fileBackupDir = fileBackupDir;
    config.bufferChunkInitialSize = bufferChunkInitialSize;
    config.bufferChunkRetentionSize = bufferChunkRetentionSize;
    config.maxBufferSize = maxBufferSize;
    config.waitUntilBufferFlushed = waitUntilBufferFlushed;
    config.waitUntilFlusherTerminated = waitUntilFlusherTerminated;
    config.flushIntervalMillis = flushIntervalMillis;
    config.senderMaxRetryCount = senderMaxRetryCount;
    return config;
}
 
开发者ID:wywy,项目名称:log4j-plugin-fluency,代码行数:24,代码来源:FluencyConfig.java

示例5: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:28,代码来源:TextAreaAppender.java

示例6: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:TerminalConsoleAppender.java

示例7: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@PluginFactory
public static ReportPortalLog4j2Appender createAppender(@PluginAttribute("name") String name,
        @PluginElement("filter") Filter filter,
        @PluginElement("layout") Layout<? extends Serializable> layout) {

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

    if (layout == null) {
        LOGGER.error("No layout provided for ReportPortalLog4j2Appender");
        return null;
    }
    return new ReportPortalLog4j2Appender(name, filter, layout);
}
 
开发者ID:reportportal,项目名称:logger-java-log4j,代码行数:17,代码来源:ReportPortalLog4j2Appender.java

示例8: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@PluginFactory
public static ConsoleLogAppender createAppender(@PluginAttribute("name") final String name, @PluginAttribute("ignoreExceptions") final String ignore, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") final Filter filter, @PluginAttribute("target") String target) {
    final boolean ignoreExceptions = Boolean.parseBoolean(ignore);
    if (name == null) {
        ConsoleLogAppender.LOGGER.error("No name provided for ConsoleLogAppender");
        return null;
    }
    if (target == null) {
        target = name;
    }
    ConsoleLogAppender.QUEUE_LOCK.writeLock().lock();
    BlockingQueue<String> queue = ConsoleLogAppender.QUEUES.get(target);
    if (queue == null) {
        queue = new LinkedBlockingQueue<>();
        ConsoleLogAppender.QUEUES.put(target, queue);
    }
    ConsoleLogAppender.QUEUE_LOCK.writeLock().unlock();
    if (layout == null) {
        layout = PatternLayout.createLayout(null, null, null, null, true, !Nukkit.useConsole, null, null);
    }
    return new ConsoleLogAppender(name, filter, layout, ignoreExceptions, queue);
}
 
开发者ID:MagicDroidX,项目名称:Brynhildr,代码行数:23,代码来源:ConsoleLogAppender.java

示例9: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@PluginFactory
public static WorkspaceLogAppender 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 WorkspaceLogAppender");
        return null;
    }

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

    return new WorkspaceLogAppender(name, filter, layout, true);
}
 
开发者ID:PlayPen,项目名称:PVI,代码行数:17,代码来源:WorkspaceLogAppender.java

示例10: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@PluginFactory
   public static SlackAppender createAppender(
    @PluginAttribute("name") String name,
    @PluginElement("Layout") Layout<? extends Serializable> layout,
    @PluginElement("Filter") final Filter filter,
    @PluginAttribute("webhookUrl") URL webhookUrl,
    @PluginAttribute("channel") String channel,
    @PluginAttribute(value = "username", defaultString = "Blazkowicz") String username,
    @PluginAttribute(value = "meltdownProtection", defaultBoolean = true) boolean meltdownProtection,
    @PluginAttribute(value = "similarMessageSize", defaultInt = 50) int similarMessageSize,
    @PluginAttribute(value = "timeBetweenSimilarLogsMs", defaultInt = 60000) int timeBetweenSimilarLogsMs,
    @PluginAttribute(value = "packagesToMute", defaultString = "") String packagesToMute,
    @PluginAttribute(value = "httpClientImpl", defaultString = "") String httpClientImpl) {
if (name == null) {
    LOGGER.error("No name provided for MyCustomAppenderImpl");
    return null;
}
if (layout == null) {
    layout = PatternLayout.createDefaultLayout();
}
Client client = findClientImpl(httpClientImpl);
SlackAppender slackAppender = new SlackAppender(name, filter, layout, webhookUrl, username, channel, meltdownProtection, similarMessageSize, timeBetweenSimilarLogsMs, client);
slackAppender.setPackagesToMute(packagesToMute);
return slackAppender;
   }
 
开发者ID:tobias-,项目名称:slack-appender,代码行数:26,代码来源:SlackAppender.java

示例11: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@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);
}
 
开发者ID:intuit,项目名称:Tank,代码行数:17,代码来源:DebuggerAppender.java

示例12: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
/**
 * A custom appender needs to declare a factory method annotated with `@PluginFactory`.
 * Log4j will parse the configuration and call this factory method to construct an appender instance with
 * the configured attributes.
 *
 * @param name           - the logger name
 * @param layout         - the layout
 * @param filter         - the filter
 * @param otherAttribute - other attributes
 * @return a text area logger
 */
@PluginFactory
public static TextAreaLogger createAppender(
        @PluginAttribute("name") String name,
        @PluginElement("Layout") Layout<? extends Serializable> layout,
        @PluginElement("Filter") final Filter filter,
        @PluginAttribute("otherAttribute") String otherAttribute) {
    if (name == null) {
        LOGGER.error("No name provided for MyCustomAppenderImpl");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    return new TextAreaLogger(name, filter, layout, true);
}
 
开发者ID:ChronixDB,项目名称:chronix.examples,代码行数:27,代码来源:TextAreaLogger.java

示例13: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@PluginFactory
public static MongoFXMessageAppender 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 StubAppender");
    return null;
  }

  if (layout == null) {
    layout = PatternLayout.createDefaultLayout();
  }
  return new MongoFXMessageAppender(name, filter, layout, ignoreExceptions);
}
 
开发者ID:daa84,项目名称:mongofx,代码行数:17,代码来源:MongoFXMessageAppender.java

示例14: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
/**
    * Factory method for the appender
    *
    * @param name        The Appender name
    * @param filter      The Filter to associate with the Appender
    * @param apiUrl      API URL
    * @param apiKey      API Key
    * @param application Application name
    * @param environment Environment
 * @param skipJson	  Mark messages w/ JSON w/ #SKIPJSON
    * @param maskEnabled Mask Enabled
    * @param masks       Masks
    * @return StackifyLogAppender
    */
   @PluginFactory
   public static StackifyLogAppender createAppender(@PluginAttribute("name") final String name,
                                                    @PluginElement("filters") final Filter filter,
                                                    @PluginAttribute("apiUrl") final String apiUrl,
                                                    @PluginAttribute("apiKey") final String apiKey,
                                                    @PluginAttribute("application") final String application,
                                                    @PluginAttribute("environment") final String environment,
                                                    @PluginAttribute("skipJson") final String skipJson,
                                                    @PluginAttribute("maskEnabled") final String maskEnabled,
                                                    @PluginElement("mask") final Mask[] masks) {
	return new StackifyLogAppender(name, filter, apiUrl, apiKey, application, environment,
			skipJson == null || Boolean.parseBoolean(skipJson),
			maskEnabled == null || Boolean.parseBoolean(maskEnabled),
			masks);
}
 
开发者ID:stackify,项目名称:stackify-log-log4j2,代码行数:30,代码来源:StackifyLogAppender.java

示例15: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginAttribute; //导入依赖的package包/类
@PluginFactory
public static MemoryAppender createAppender(
        @PluginAttribute("name") String name,
        @PluginElement("Layout") Layout<? extends Serializable> layout,
        @PluginElement("Filter") final Filter filter,
        @PluginAttribute("numberOfLines") String numberOfLines) {
    if (name == null) {
        LOGGER.error("No name provided for MemoryAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    if (numberOfLines != null) {
    	logsize = Integer.valueOf(numberOfLines);
    }
    return new MemoryAppender(name, filter, layout, true);
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:19,代码来源:MemoryAppender.java


注:本文中的org.apache.logging.log4j.core.config.plugins.PluginAttribute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。