當前位置: 首頁>>代碼示例>>Java>>正文


Java PluginElement類代碼示例

本文整理匯總了Java中org.apache.logging.log4j.core.config.plugins.PluginElement的典型用法代碼示例。如果您正苦於以下問題:Java PluginElement類的具體用法?Java PluginElement怎麽用?Java PluginElement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PluginElement類屬於org.apache.logging.log4j.core.config.plugins包,在下文中一共展示了PluginElement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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.PluginElement; //導入依賴的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.PluginElement; //導入依賴的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: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例5: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例6: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例7: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例8: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例9: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例10: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例11: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例12: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例13: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例14: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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

示例15: createAppender

import org.apache.logging.log4j.core.config.plugins.PluginElement; //導入依賴的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:NeptunePowered,項目名稱:NeptuneMod,代碼行數:19,代碼來源:TerminalConsoleAppender.java


注:本文中的org.apache.logging.log4j.core.config.plugins.PluginElement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。