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


Java PatternLayout.createDefaultLayout方法代碼示例

本文整理匯總了Java中org.apache.logging.log4j.core.layout.PatternLayout.createDefaultLayout方法的典型用法代碼示例。如果您正苦於以下問題:Java PatternLayout.createDefaultLayout方法的具體用法?Java PatternLayout.createDefaultLayout怎麽用?Java PatternLayout.createDefaultLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.logging.log4j.core.layout.PatternLayout的用法示例。


在下文中一共展示了PatternLayout.createDefaultLayout方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的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

示例2: watch

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
public void watch(Class<?> loggerClass, Level level) {
    this.loggerClass = loggerClass;
    Appender appender = new AbstractAppender(APPENDER_NAME, null, PatternLayout.createDefaultLayout()) {
        @Override
        public void append(LogEvent event) {
            logEvents.add(event);
        }
    };
    appender.start();
    final LoggerContext ctx = getLoggerContext();
    LoggerConfig loggerConfig = ctx.getConfiguration().getLoggerConfig(loggerClass.getName());
    oldLevel = loggerConfig.getLevel();
    loggerConfig.setLevel(level);
    loggerConfig.addAppender(appender, level, null);
    ctx.updateLoggers();
}
 
開發者ID:TNG,項目名稱:ArchUnit,代碼行數:17,代碼來源:LogTestRule.java

示例3: ProcessCallable

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
public ProcessCallable(MCRSession session, Session webSocketSession) {
    this.commands = new ObservableCommandList();
    this.session = session;
    this.webSocketSession = webSocketSession;
    this.logs = new ObservableLogEventDeque();
    this.logGrabber = new Log4JGrabber(MCRWebCLIContainer.class.getSimpleName() + session.getID(), null,
        PatternLayout.createDefaultLayout());
    this.logGrabber.start();

    this.commandListObserver = new CommandListObserver(commands, webSocketSession);
    commands.addObserver(commandListObserver);
    this.logEventQueueObserver = new LogEventDequeObserver(logs, webSocketSession);
    logs.addObserver(logEventQueueObserver);
    this.currentCommand = "";
    this.continueIfOneFails = false;
}
 
開發者ID:MyCoRe-Org,項目名稱:mycore,代碼行數:17,代碼來源:MCRWebCLIContainer.java

示例4: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的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

示例5: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的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

示例6: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的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

示例7: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
@PluginFactory
public static ApiLogAppenderImpl createAppender(
        @PluginAttribute("name") String name,
        @PluginElement("Layout") Layout<? extends Serializable> layout,
        @PluginElement("Filter") final Filter filter,
        @PluginAttribute("format") String otherAttribute) {
    if (name == null) {
        LOGGER.error("No name provided for ApiLogAppenderImpl");
        return null;
    }
    
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    
    return new ApiLogAppenderImpl(name, filter, layout, true);
}
 
開發者ID:haneev,項目名稱:TweetRetriever,代碼行數:18,代碼來源:ApiLogAppenderImpl.java

示例8: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的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

示例9: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的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

示例10: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的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

示例11: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
@PluginFactory
public static ConsoleWindowAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout layout, @PluginElement("Filters") Filter filter)
{

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

    if (layout == null)
    {
        layout = PatternLayout.createDefaultLayout();
    }
    //noinspection unchecked
    return new ConsoleWindowAppender(name, filter, layout, ignoreExceptions);
}
 
開發者ID:DoubleDoorDevelopment,項目名稱:D3Launcher,代碼行數:18,代碼來源:ConsoleWindowAppender.java

示例12: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
@PluginFactory
public static JesterJAppender createAppender(@PluginAttribute("name") String name,
                                             @PluginAttribute("ignoreExceptions") boolean ignoreExceptions,
                                             @PluginElement("Layout") Layout layout,
                                             @PluginElement("Filters") Filter filter) {

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

  manager = createManager();
  if (manager == null) {
    return null;
  }
  if (layout == null) {
    layout = PatternLayout.createDefaultLayout();
  }
  cassandra.addStatement(FTI_INSERT_Q, INSERT_FTI);
  cassandra.addStatement(REG_INSERT_Q, INSERT_REG);
  return new JesterJAppender(name, layout, filter, manager, ignoreExceptions);
}
 
開發者ID:nsoft,項目名稱:jesterj,代碼行數:23,代碼來源:JesterJAppender.java

示例13: build

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
@Override
public ServletAppender build() {
	final String name = getName();
	if (name == null) {
		LOGGER.error("No name provided for ServletAppender");
	}
	final ServletContext servletContext = WebLoggerContextUtils.getServletContext();
	if (servletContext == null) {
		LOGGER.error("No servlet context is available");
		return null;
	}
	Layout<? extends Serializable> layout = getLayout();
	if (layout == null) {
		layout = PatternLayout.createDefaultLayout();
	} else if (!(layout instanceof AbstractStringLayout)) {
		LOGGER.error("Layout must be a StringLayout to log to ServletContext");
		return null;
	}
	return new ServletAppender(name, layout, getFilter(), servletContext, isIgnoreExceptions(), logThrowables);
}
 
開發者ID:apache,項目名稱:logging-log4j2,代碼行數:21,代碼來源:ServletAppender.java

示例14: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
/**
 * Creates a Console Appender.
 *
 * @param layout The layout to use (required).
 * @param filter The Filter or null.
 * @param targetStr The target ("SYSTEM_OUT" or "SYSTEM_ERR"). The default is "SYSTEM_OUT".
 * @param name The name of the Appender (required).
 * @param follow If true will follow changes to the underlying output stream.
 * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they
 *            are propagated to the caller.
 * @return The ConsoleAppender.
 * @deprecated Deprecated in 2.7; use {@link #newBuilder()}.
 */
@Deprecated
public static ConsoleAppender createAppender(Layout<? extends Serializable> layout,
        final Filter filter,
        final String targetStr,
        final String name,
        final String follow,
        final String ignore) {
    if (name == null) {
        LOGGER.error("No name provided for ConsoleAppender");
        return null;
    }
    if (layout == null) {
        layout = PatternLayout.createDefaultLayout();
    }
    final boolean isFollow = Boolean.parseBoolean(follow);
    final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
    final Target target = targetStr == null ? DEFAULT_TARGET : Target.valueOf(targetStr);
    return new ConsoleAppender(name, layout, filter, getManager(target, isFollow, false, layout), ignoreExceptions, target);
}
 
開發者ID:apache,項目名稱:logging-log4j2,代碼行數:33,代碼來源:ConsoleAppender.java

示例15: createAppender

import org.apache.logging.log4j.core.layout.PatternLayout; //導入方法依賴的package包/類
/**
 * Method for initializing a new instance of JFXAppender; used by Log4j.
 *
 * @param layout the layout for events
 * @param filter the initial filter of the appender
 * @return the newly created JFXAppender
 */
@PluginFactory
public static JFXAppender createAppender(
        @PluginElement("Layout") final Layout<? extends Serializable> layout,
        @PluginElement("Filter") final Filter filter) {
    return new JFXAppender("JFXAppender", filter,
            layout == null ? PatternLayout.createDefaultLayout() : layout, true);
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:15,代碼來源:JFXAppender.java


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