Java Code Examples for org.apache.logging.log4j.core.config.ConfigurationFactory#setConfigurationFactory()

The following examples show how to use org.apache.logging.log4j.core.config.ConfigurationFactory#setConfigurationFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoggerTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    rbUS = ResourceBundle.getBundle("L7D", new Locale("en", "US"));
    assertNotNull(rbUS);

    rbFR = ResourceBundle.getBundle("L7D", new Locale("fr", "FR"));
    assertNotNull("Got a null resource bundle.", rbFR);

    rbCH = ResourceBundle.getBundle("L7D", new Locale("fr", "CH"));
    assertNotNull("Got a null resource bundle.", rbCH);

    ConfigurationFactory.setConfigurationFactory(configurationFactory);
}
 
Example 2
Source File: LoggerTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    rbUS = ResourceBundle.getBundle("L7D", new Locale("en", "US"));
    assertNotNull(rbUS);

    rbFR = ResourceBundle.getBundle("L7D", new Locale("fr", "FR"));
    assertNotNull("Got a null resource bundle.", rbFR);

    rbCH = ResourceBundle.getBundle("L7D", new Locale("fr", "CH"));
    assertNotNull("Got a null resource bundle.", rbCH);

    ConfigurationFactory.setConfigurationFactory(configurationFactory);
}
 
Example 3
Source File: YamlLayoutTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ThreadContext.clearAll();
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 4
Source File: Rfc5424LayoutTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setupClass() {
    StatusLogger.getLogger().setLevel(Level.OFF);
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 5
Source File: JsonLayoutTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ThreadContext.clearAll();
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 6
Source File: Log4j2EcsLayoutTest.java    From ecs-logging-java with Apache License 2.0 4 votes vote down vote up
@BeforeAll
static void setupClass() {
    ConfigurationFactory.setConfigurationFactory(configFactory);
}
 
Example 7
Source File: BHBot.java    From BHBot with GNU General Public License v3.0 4 votes vote down vote up
private void reloadLogger() {
    ConfigurationFactory configFactory = new BHBotConfigurationFactory();
    ConfigurationFactory.setConfigurationFactory(configFactory);
    LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
    ctx.start(configFactory.getConfiguration(ctx, ConfigurationSource.NULL_SOURCE));
}
 
Example 8
Source File: SetConfigurationFactoryIntegrationTest.java    From tutorials with MIT License 4 votes vote down vote up
@BeforeClass
public static void setUp() {
    CustomConfigurationFactory customConfigurationFactory = new CustomConfigurationFactory();
    ConfigurationFactory.setConfigurationFactory(customConfigurationFactory);
}
 
Example 9
Source File: CsvLogEventLayoutTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 10
Source File: CategoryTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    appender.start();
    ConfigurationFactory.setConfigurationFactory(cf);
    LoggerContext.getContext().reconfigure();
}
 
Example 11
Source File: CategoryTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    appender.start();
    ConfigurationFactory.setConfigurationFactory(cf);
    LoggerContext.getContext().reconfigure();
}
 
Example 12
Source File: XmlLayoutTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 13
Source File: GelfLayoutTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ConfigurationFactory.setConfigurationFactory(configFactory);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 14
Source File: HtmlLayoutTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 15
Source File: SyslogLayoutTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}
 
Example 16
Source File: PatternLayoutTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ConfigurationFactory.setConfigurationFactory(cf);
    final LoggerContext ctx = LoggerContext.getContext();
    ctx.reconfigure();
}