org.apache.logging.log4j.core.Appender.getLayout()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.apache.logging.log4j.core.Appender.getLayout()方法的一些代码示例,展示了Appender.getLayout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Appender.getLayout()方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Appender
类名称:Appender
方法名:getLayout

Appender.getLayout介绍

[英]Returns the Layout used by this Appender if applicable.
[中]返回此追加器使用的布局(如果适用)。

代码示例

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testEnvironment() throws Exception {
  ctx = Configurator.initialize("-config", null);
  LogManager.getLogger("org.apache.test.TestConfigurator");
  final Configuration config = ctx.getConfiguration();
  assertNotNull("No configuration", config);
  assertEquals("Incorrect Configuration.", CONFIG_NAME, config.getName());
  final Map<String, Appender> map = config.getAppenders();
  assertNotNull("Appenders map should not be null.", map);
  assertThat(map, hasSize(greaterThan(0)));
  assertThat("No ListAppender named List2", map, hasKey("List2"));
  final Appender app = map.get("List2");
  final Layout<? extends Serializable> layout = app.getLayout();
  assertNotNull("Appender List2 does not have a Layout", layout);
  assertThat("Appender List2 is not configured with a PatternLayout", layout, instanceOf(PatternLayout.class));
  final String pattern = ((PatternLayout) layout).getConversionPattern();
  assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
  assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public String getLayout() {
  return String.valueOf(appender.getLayout());
}

代码示例来源:origin: org.apereo.cas/cas-server-core-logging

builder.append("name", appender.getName());
builder.append("state", appender.getState());
builder.append("layoutFormat", appender.getLayout().getContentFormat());
builder.append("layoutContentType", appender.getLayout().getContentType());
if (appender instanceof FileAppender) {
  builder.append(FILE_PARAM, ((FileAppender) appender).getFileName());

代码示例来源:origin: Waikato/wekaDeeplearning4j

Layout<? extends Serializable> layout = consoleAppender.getLayout();

相关文章