本文整理汇总了Java中org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java BuiltConfiguration类的具体用法?Java BuiltConfiguration怎么用?Java BuiltConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuiltConfiguration类属于org.apache.logging.log4j.core.config.builder.impl包,在下文中一共展示了BuiltConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testBuilder
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
@Test
public void testBuilder() throws Exception {
final ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
builder.setStatusLevel(Level.ERROR);
builder.setConfigurationName("BuilderTest");
builder.add(builder.newFilter("ThresholdFilter", Filter.Result.ACCEPT, Filter.Result.NEUTRAL)
.addAttribute("level", Level.DEBUG));
final AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target",
ConsoleAppender.Target.SYSTEM_OUT);
appenderBuilder.add(builder.newLayout("PatternLayout").
addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
appenderBuilder.add(builder.newFilter("MarkerFilter", Filter.Result.DENY,
Filter.Result.NEUTRAL).addAttribute("marker", "FLOW"));
builder.add(appenderBuilder);
builder.add(builder.newLogger("org.apache.logging.log4j", Level.DEBUG).
add(builder.newAppenderRef("Stdout")).
addAttribute("additivity", false));
builder.add(builder.newRootLogger(Level.ERROR).add(builder.newAppenderRef("Stdout")));
ctx = Configurator.initialize(builder.build());
final Configuration config = ctx.getConfiguration();
assertNotNull("No configuration", config);
assertEquals("Unexpected Configuration", "BuilderTest", config.getName());
assertThat(config.getAppenders(), hasSize(equalTo(1)));
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:25,代码来源:TestConfigurator.java
示例2: createConfiguration
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private Configuration createConfiguration(final String name, ConfigurationBuilder<BuiltConfiguration> builder) {
builder.setConfigurationName(name);
/* Only internal Log4J2 messages with level ERROR will be logged */
builder.setStatusLevel(Level.ERROR);
/* Create appender that logs to System.out */
AppenderComponentBuilder appenderBuilder = builder.newAppender("STDOUT", "CONSOLE")
.addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT);
/* Create pattern for log messages */
appenderBuilder.add(builder.newLayout("PatternLayout")
.addAttribute("pattern", "[%d{HH:mm:ss}] (%c{1}) [%level] %msg%n%throwable"));
/*timestamp logger name level log message & optional throwable */
builder.add(appenderBuilder);
/* Create logger that uses STDOUT appender */
builder.add(builder.newLogger("JukeBot", JUKEBOT_LOG_LEVEL)
.add(builder.newAppenderRef("STDOUT"))
.addAttribute("additivity", false));
/* Create root logger--messages not from the above logger will all go through this one */
builder.add(builder.newRootLogger(LIB_LOG_LEVEL).add(builder.newAppenderRef("STDOUT")));
return builder.build();
}
开发者ID:Devoxin,项目名称:JukeBot,代码行数:23,代码来源:Log4JConfig.java
示例3: test_lineSeparator_suffix
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private void test_lineSeparator_suffix(LogEvent logEvent, boolean prettyPrintEnabled, SoftAssertions assertions) {
// Create the layout.
BuiltConfiguration config = ConfigurationBuilderFactory.newConfigurationBuilder().build();
LogstashLayout layout = LogstashLayout
.newBuilder()
.setConfiguration(config)
.setTemplateUri("classpath:LogstashJsonEventLayoutV1.json")
.setPrettyPrintEnabled(prettyPrintEnabled)
.build();
// Check the serialized event.
String serializedLogEvent = layout.toSerializable(logEvent);
String assertionCaption = String.format("testing lineSeperator (prettyPrintEnabled=%s)", prettyPrintEnabled);
assertions.assertThat(serializedLogEvent).as(assertionCaption).endsWith("}" + System.lineSeparator());
}
开发者ID:vy,项目名称:log4j2-logstash-layout,代码行数:18,代码来源:LogstashLayoutTest.java
示例4: buildConfiguration
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
protected Configuration buildConfiguration() {
ConfigurationBuilder<BuiltConfiguration> builder = newConfigurationBuilder();
builder.setConfigurationName(Log4j2RedactorTest.class.getName());
builder.setStatusLevel(Level.INFO);
AppenderComponentBuilder appenderBuilder = builder.newAppender("Stderr", "CONSOLE")
.addAttribute("target", ConsoleAppender.Target.SYSTEM_ERR);
appenderBuilder.add(builder.newLayout("PatternLayout")
.addAttribute("pattern", "%msg"));
builder.add(appenderBuilder);
AppenderComponentBuilder rewriteBuilder = builder.newAppender("Redactor", "Rewrite")
.addComponent(builder.newComponent("RedactorPolicy", "RedactorPolicy")
.addAttribute("rules", resourcePath + getPolicyFilename()))
.addComponent(builder.newAppenderRef("Stderr"));
builder.add(rewriteBuilder);
builder.add(builder.newRootLogger(Level.INFO)
.add(builder.newAppenderRef("Redactor")));
return builder.build();
}
开发者ID:cloudera,项目名称:logredactor,代码行数:23,代码来源:Log4j2RedactorTest.java
示例5: testBuildConfiguration
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
@Test
public void testBuildConfiguration() throws Exception {
try {
System.setProperty(Constants.LOG4J_CONTEXT_SELECTOR,
"org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
final ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory
.newConfigurationBuilder();
CustomConfigurationFactory.addTestFixtures("config name", builder);
final Configuration configuration = builder.build();
try (LoggerContext ctx = Configurator.initialize(configuration)) {
validate(configuration);
}
} finally {
System.getProperties().remove(Constants.LOG4J_CONTEXT_SELECTOR);
}
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:17,代码来源:ConfigurationAssemblerTest.java
示例6: addTestFixtures
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private void addTestFixtures(final String name, final ConfigurationBuilder<BuiltConfiguration> builder) {
builder.setConfigurationName(name);
builder.setStatusLevel(Level.ERROR);
builder.setShutdownTimeout(5000, TimeUnit.MILLISECONDS);
builder.add(builder.newScriptFile("target/test-classes/scripts/filter.groovy").addIsWatched(true));
builder.add(builder.newFilter("ThresholdFilter", Filter.Result.ACCEPT, Filter.Result.NEUTRAL)
.addAttribute("level", Level.DEBUG));
final AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT);
appenderBuilder.add(builder.newLayout("PatternLayout").
addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
appenderBuilder.add(builder.newFilter("MarkerFilter", Filter.Result.DENY,
Filter.Result.NEUTRAL).addAttribute("marker", "FLOW"));
builder.add(appenderBuilder);
builder.add(builder.newLogger("org.apache.logging.log4j", Level.DEBUG, true).
add(builder.newAppenderRef("Stdout")).
addAttribute("additivity", false));
builder.add(builder.newLogger("org.apache.logging.log4j.core").
add(builder.newAppenderRef("Stdout")));
builder.add(builder.newRootLogger(Level.ERROR).add(builder.newAppenderRef("Stdout")));
builder.addProperty("MyKey", "MyValue");
builder.add(builder.newCustomLevel("Panic", 17));
builder.setPackages("foo,bar");
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:27,代码来源:ConfigurationBuilderTest.java
示例7: addTestFixtures
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
public static Configuration addTestFixtures(final String name, final ConfigurationBuilder<BuiltConfiguration> builder) {
builder.setConfigurationName(name);
builder.setStatusLevel(Level.ERROR);
builder.add(builder.newScriptFile("target/test-classes/scripts/filter.groovy").addIsWatched(true));
builder.add(builder.newFilter("ThresholdFilter", Filter.Result.ACCEPT, Filter.Result.NEUTRAL)
.addAttribute("level", Level.DEBUG));
final AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT);
appenderBuilder.add(builder.
newLayout("PatternLayout").
addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
appenderBuilder.add(builder.
newFilter("MarkerFilter", Filter.Result.DENY, Filter.Result.NEUTRAL).
addAttribute("marker", "FLOW"));
builder.add(appenderBuilder);
builder.add(builder.newLogger("org.apache.logging.log4j", Level.DEBUG, true).
add(builder.newAppenderRef("Stdout")).
addAttribute("additivity", false));
builder.add(builder.newRootLogger(Level.ERROR).add(builder.newAppenderRef("Stdout")));
builder.add(builder.newCustomLevel("Panic", 17));
return builder.build();
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:26,代码来源:CustomConfigurationFactory.java
示例8: addAppenderRef
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private static void addAppenderRef (final AppenderComponentBuilder appenderCom,
final List <AppenderRefSetting> appenderRef, final ConfigurationBuilder <BuiltConfiguration> build) {
for (final AppenderRefSetting setting : appenderRef) {
final AppenderRefComponentBuilder ref = build.newAppenderRef (setting.getRef ());
addAttributes (ref, setting.getAttributes ());
appenderCom.addComponent (ref);
}
}
开发者ID:WasiqB,项目名称:coteafs-logger,代码行数:9,代码来源:ConfigBuilder.java
示例9: addLayout
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private static void addLayout (final AppenderComponentBuilder appenderCom, final LayoutSetting layout,
final ConfigurationBuilder <BuiltConfiguration> build) {
if (layout == null) return;
final LayoutComponentBuilder layoutCom = build.newLayout (layout.getPlugin ());
addAttributes (layoutCom, layout.getAttributes ());
appenderCom.add (layoutCom);
}
开发者ID:WasiqB,项目名称:coteafs-logger,代码行数:8,代码来源:ConfigBuilder.java
示例10: addAppenders
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private void addAppenders (final ConfigurationBuilder <BuiltConfiguration> build) {
for (final AppenderSetting appender : this.appenders) {
final AppenderComponentBuilder appenderCom = build.newAppender (appender.getName (), appender.getPlugin ());
addAttributes (appenderCom, appender.getAttributes ());
addLayout (appenderCom, appender.getLayout (), build);
addAppenderRef (appenderCom, appender.getAppenderRef (), build);
addComponent (appenderCom, appender.getComponent (), build);
build.add (appenderCom);
}
}
开发者ID:WasiqB,项目名称:coteafs-logger,代码行数:11,代码来源:ConfigBuilder.java
示例11: addComponent
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private <K extends ComponentBuilder <K>> void addComponent (final ComponentBuilder <K> component,
final ComponentSetting setting, final ConfigurationBuilder <BuiltConfiguration> build) {
if (setting == null) return;
final ComponentBuilder <?> comp = build.newComponent (setting.getPlugin ());
for (final ComponentSetting c : setting.getComponents ()) {
final ComponentBuilder <?> newComp = build.newComponent (c.getPlugin ());
addAttributes (newComp, c.getAttributes ());
if (!c .getComponents ()
.isEmpty ()) {
addComponent (newComp, c, build);
}
comp.addComponent (newComp);
}
component.addComponent (comp);
}
开发者ID:WasiqB,项目名称:coteafs-logger,代码行数:16,代码来源:ConfigBuilder.java
示例12: addRootLogger
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private void addRootLogger (final ConfigurationBuilder <BuiltConfiguration> build) {
final RootLoggerComponentBuilder root = build.newRootLogger (this.loggers .getLevel ()
.getStatus ());
for (final AppenderRefSetting setting : this.loggers.getAppenderRef ()) {
final AppenderRefComponentBuilder ref = build.newAppenderRef (setting.getRef ());
addAttributes (ref, setting.getAttributes ());
root.add (ref);
}
build.add (root);
}
开发者ID:WasiqB,项目名称:coteafs-logger,代码行数:11,代码来源:ConfigBuilder.java
示例13: test_inline_template
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
@Test
public void test_inline_template() throws Exception {
// Create the log event.
SimpleMessage message = new SimpleMessage("Hello, World");
String timestamp = "2017-09-28T17:13:29.098+02:00";
long timeMillis = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").parse(timestamp).getTime();
LogEvent logEvent = Log4jLogEvent
.newBuilder()
.setLoggerName(LogstashLayoutTest.class.getSimpleName())
.setLevel(Level.INFO)
.setMessage(message)
.setTimeMillis(timeMillis)
.build();
// Create the template.
ObjectNode templateRootNode = JSON_NODE_FACTORY.objectNode();
templateRootNode.put("@timestamp", "${json:timestamp}");
String staticFieldName = "staticFieldName";
String staticFieldValue = "staticFieldValue";
templateRootNode.put(staticFieldName, staticFieldValue);
String template = templateRootNode.toString();
// Create the layout.
BuiltConfiguration configuration = ConfigurationBuilderFactory.newConfigurationBuilder().build();
String timeZoneId = TimeZone.getTimeZone("Europe/Amsterdam").getID();
LogstashLayout layout = LogstashLayout
.newBuilder()
.setConfiguration(configuration)
.setTemplate(template)
.setTimeZoneId(timeZoneId)
.build();
// Check the serialized event.
String serializedLogEvent = layout.toSerializable(logEvent);
JsonNode rootNode = OBJECT_MAPPER.readTree(serializedLogEvent);
assertThat(point(rootNode, "@timestamp").asText()).isEqualTo(timestamp);
assertThat(point(rootNode, staticFieldName).asText()).isEqualTo(staticFieldValue);
}
开发者ID:vy,项目名称:log4j2-logstash-layout,代码行数:41,代码来源:LogstashLayoutTest.java
示例14: initLog4j2WithoutConfigFile
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
/**
* 初始化日志配置
*/
public static void initLog4j2WithoutConfigFile() {
System.out.println("no local log4j2.xml file found,init logContext");
ConfigurationBuilder< BuiltConfiguration > builder =
ConfigurationBuilderFactory.newConfigurationBuilder();
builder.setStatusLevel( Level.ERROR);
builder.setConfigurationName("RollingBuilder");
// create the console appender
AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target",
ConsoleAppender.Target.SYSTEM_OUT);
appenderBuilder.add(builder.newLayout("PatternLayout").
addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
builder.add( appenderBuilder );
// LayoutComponentBuilder layoutBuilder = builder.newLayout("PatternLayout")
// .addAttribute("pattern", "%d [%t] %-5level: %msg%n");
// ComponentBuilder triggeringPolicy = builder.newComponent("Policies")
// .addComponent(builder.newComponent("CronTriggeringPolicy").addAttribute("schedule", "0 0 0 * * ?"))
// .addComponent(builder.newComponent("SizeBasedTriggeringPolicy").addAttribute("size", "100M"));
// appenderBuilder = builder.newAppender("rolling", "RollingFile")
// .addAttribute("fileName", "target/rolling.log")
// .addAttribute("filePattern", "target/archive/rolling-%d{MM-dd-yy}.log.gz")
// .add(layoutBuilder)
// .addComponent(triggeringPolicy);
// builder.add(appenderBuilder);
builder.add(builder.newRootLogger(Level.INFO).add(builder.newAppenderRef("Stdout")));
builder.add(builder.newLogger("com.jeesuite", Level.TRACE).add(builder.newAppenderRef("Stdout")).addAttribute("additivity", false));
Configurator.initialize(builder.build());
}
开发者ID:vakinge,项目名称:jeesuite-libs,代码行数:36,代码来源:LogContextInitializer.java
示例15: setup
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
@Before
public void setup() {
ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
String webhookUrl = System.getProperty(SLACK_WEBHOOK, System.getenv(SLACK_WEBHOOK));
assertNotNull(SLACK_WEBHOOK + " MUST NOT be null", webhookUrl);
AppenderComponentBuilder appenderComponentBuilder = builder.newAppender("SlackerFoo", "Slack");
appenderComponentBuilder.addAttribute("webhookUrl", webhookUrl);
appenderComponentBuilder.addAttribute("httpClientImpl", OkHttp3Client.class.getName());
appenderComponentBuilder.add(builder.newLayout("PatternLayout").
addAttribute("pattern", "%-5p - [%t] %-26.26c{1}"));
builder.add(appenderComponentBuilder);
builder.add(builder.newRootLogger(Level.INFO).add(builder.newAppenderRef("SlackerFoo")));
Configurator.initialize(builder.build());
}
开发者ID:tobias-,项目名称:slack-appender,代码行数:15,代码来源:SlackAppenderIT.java
示例16: intializeLoggers
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
public static void intializeLoggers() {
ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
builder.setConfigurationName("logger");
RootLoggerComponentBuilder rootLogger = builder.newRootLogger(Level.DEBUG);
builder.add(rootLogger);
Configurator.initialize(builder.build());
}
开发者ID:ldbc,项目名称:ldbc_graphalytics,代码行数:9,代码来源:LogUtil.java
示例17: buildConfigurationBuilder
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
/**
* Parses a Log4j 1.2 properties configuration file in ISO 8859-1 encoding into a ConfigurationBuilder.
*
* @param input
* InputStream to read from is assumed to be ISO 8859-1, and will not be closed.
* @return the populated ConfigurationBuilder, never {@literal null}
* @throws IOException
* if unable to read the input
* @throws ConfigurationException
* if the input does not contain a valid configuration
*/
public ConfigurationBuilder<BuiltConfiguration> buildConfigurationBuilder(final InputStream input)
throws IOException {
try {
properties.load(input);
strSubstitutorProperties = new StrSubstitutor(properties);
strSubstitutorSystem = new StrSubstitutor(System.getProperties());
final String rootCategoryValue = getLog4jValue(ROOTCATEGORY);
final String rootLoggerValue = getLog4jValue(ROOTLOGGER);
if (rootCategoryValue == null && rootLoggerValue == null) {
// This is not a Log4j 1 properties configuration file.
warn("Missing " + ROOTCATEGORY + " or " + ROOTLOGGER + " in " + input);
// throw new ConfigurationException(
// "Missing " + ROOTCATEGORY + " or " + ROOTLOGGER + " in " + input);
}
builder.setConfigurationName("Log4j1");
// DEBUG
final String debugValue = getLog4jValue("debug");
if (Boolean.valueOf(debugValue)) {
builder.setStatusLevel(Level.DEBUG);
}
// Root
buildRootLogger(getLog4jValue(ROOTCATEGORY));
buildRootLogger(getLog4jValue(ROOTLOGGER));
// Appenders
final Map<String, String> appenderNameToClassName = buildClassToPropertyPrefixMap();
for (final Map.Entry<String, String> entry : appenderNameToClassName.entrySet()) {
final String appenderName = entry.getKey();
final String appenderClass = entry.getValue();
buildAppender(appenderName, appenderClass);
}
// Loggers
buildLoggers("log4j.category.");
buildLoggers("log4j.logger.");
buildProperties();
return builder;
} catch (final IllegalArgumentException e) {
throw new ConfigurationException(e);
}
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:51,代码来源:Log4j1ConfigurationParser.java
示例18: getConfiguration
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
@Override
public Configuration getConfiguration(final LoggerContext loggerContext, final ConfigurationSource source) {
final ConfigurationBuilder<BuiltConfiguration> builder;
try (final InputStream configStream = source.getInputStream()) {
builder = new Log4j1ConfigurationParser().buildConfigurationBuilder(configStream);
} catch (final IOException e) {
throw new ConfigurationException("Unable to load " + source, e);
}
return builder.build();
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:11,代码来源:Log4j1ConfigurationFactory.java
示例19: addTestFixtures
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
private void addTestFixtures(final String name, final ConfigurationBuilder<BuiltConfiguration> builder) {
builder.setConfigurationName(name);
builder.setStatusLevel(Level.ERROR);
builder.setShutdownTimeout(5000, TimeUnit.MILLISECONDS);
builder.add(builder.newScriptFile("target/test-classes/scripts/filter.groovy").addIsWatched(true));
builder.add(builder.newFilter("ThresholdFilter", Filter.Result.ACCEPT, Filter.Result.NEUTRAL)
.addAttribute("level", Level.DEBUG));
final AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT);
appenderBuilder.add(builder.newLayout("PatternLayout").
addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
appenderBuilder.add(builder.newFilter("MarkerFilter", Filter.Result.DENY,
Filter.Result.NEUTRAL).addAttribute("marker", "FLOW"));
builder.add(appenderBuilder);
final AppenderComponentBuilder appenderBuilder2 = builder.newAppender("Kafka", "Kafka").addAttribute("topic", "my-topic");
appenderBuilder2.addComponent(builder.newProperty("bootstrap.servers", "localhost:9092"));
appenderBuilder2.add(builder.newLayout("GelfLayout").
addAttribute("host", "my-host").
addComponent(builder.newKeyValuePair("extraField", "extraValue")));
builder.add(appenderBuilder2);
builder.add(builder.newLogger("org.apache.logging.log4j", Level.DEBUG, true).
add(builder.newAppenderRef("Stdout")).
addAttribute("additivity", false));
builder.add(builder.newLogger("org.apache.logging.log4j.core").
add(builder.newAppenderRef("Stdout")));
builder.add(builder.newRootLogger(Level.ERROR).add(builder.newAppenderRef("Stdout")));
builder.addProperty("MyKey", "MyValue");
builder.add(builder.newCustomLevel("Panic", 17));
builder.setPackages("foo,bar");
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:34,代码来源:ConfigurationBuilderTest.java
示例20: testXmlConstructing
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; //导入依赖的package包/类
@Test
public void testXmlConstructing() throws Exception {
//assumeTrue(System.lineSeparator().length() == 1); // Only run test on platforms with single character line endings (such as Linux), not on Windows
final ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
addTestFixtures("config name", builder);
final String xmlConfiguration = builder.toXmlConfiguration();
assertEquals(expectedXml, xmlConfiguration);
}
开发者ID:apache,项目名称:logging-log4j2,代码行数:9,代码来源:ConfigurationBuilderTest.java
注:本文中的org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论