当前位置: 首页>>代码示例>>Java>>正文


Java BasicConfigurator.resetConfiguration方法代码示例

本文整理汇总了Java中org.apache.log4j.BasicConfigurator.resetConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java BasicConfigurator.resetConfiguration方法的具体用法?Java BasicConfigurator.resetConfiguration怎么用?Java BasicConfigurator.resetConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.log4j.BasicConfigurator的用法示例。


在下文中一共展示了BasicConfigurator.resetConfiguration方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpDatabase

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
@Before
public void setUpDatabase() throws Exception {
   BasicConfigurator.resetConfiguration();
   BasicConfigurator.configure();

   // Create H2 database instance
   database = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();

   // Add synonym table with some content
   JdbcTemplate template = new JdbcTemplate(database);
   template.execute("create table synonyms(synonyms varchar(256))");
   template.execute("insert into synonyms(synonyms) values('test1=>testA,testB')");
   template.execute("insert into synonyms(synonyms) values('test2=>testC,testD')");

   // Register data source with JNDI
   SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
   builder.bind("java:comp/env/dataSource", database);
}
 
开发者ID:shopping24,项目名称:solr-jdbc,代码行数:19,代码来源:JdbcSynonymFilterFactoryTest.java

示例2: setUpDatabase

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
@Before
public void setUpDatabase() throws Exception {
   BasicConfigurator.resetConfiguration();
   BasicConfigurator.configure();

   // Create H2 database instance
   database = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();

   // Add synonym table with some content
   JdbcTemplate template = new JdbcTemplate(database);
   template.execute("create table stopwords(stopword varchar(255))");
   template.execute("insert into stopwords values ('somestring')");
   template.execute("insert into stopwords values ('anotherstring')");

   // Register data source with JNDI
   SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
   builder.bind("java:comp/env/dataSource", database);
}
 
开发者ID:shopping24,项目名称:solr-jdbc,代码行数:19,代码来源:JdbcStopFilterFactoryTest.java

示例3: after

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
@Override
public void after() {
    if (!notConfigured) {
        logger.info("Reset basic Log4J configuration...");
        BasicConfigurator.resetConfiguration();
        notConfigured = true;
    }
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:9,代码来源:InitLog4jLoggingRule.java

示例4: after

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
@After
public void after() throws Exception {
    Scheduler.$.disconnected();
    BasicConfigurator.resetConfiguration();

    Scheduler.Config config = Scheduler.$.config;
    config.api = null;
    config.jar = null;

    Nodes.storage.clear();
}
 
开发者ID:elodina,项目名称:hdfs-mesos,代码行数:12,代码来源:HdfsMesosTestCase.java

示例5: setJobDescriptorcUri

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
@BeforeClass
public static void setJobDescriptorcUri() throws Exception {
    jobDescriptorUri = TestStaxJobFactory.class.getResource("/org/ow2/proactive/scheduler/common/job/factories/job_update_variables.xml")
                                               .toURI();
    jobDescriptorSysPropsUri = TestStaxJobFactory.class.getResource("/org/ow2/proactive/scheduler/common/job/factories/job_update_variables_using_system_properties.xml")
                                                       .toURI();
    BasicConfigurator.resetConfiguration();
    BasicConfigurator.configure();
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:10,代码来源:TestStaxJobFactory.java

示例6: initialize

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
public static void initialize(Consumer<UnitTestEnvironmentSetupDelegate> initializer) throws IllegalAccessException {
     BasicConfigurator.resetConfiguration();
     BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%m%n")));

     if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
         final Set<URI> baseURIs = new HashSet<>();
         initializer.accept(new UnitTestEnvironmentSetupDelegate() {
             @Override
             public void registerQVTOResolutionURIs(URI uriToRegister) {
                 baseURIs.add(uriToRegister);
             }
             
             @Override
             public void registerPlatformUris(String platformID, URI uri) {
                 EcorePlugin.getPlatformResourceMap().put(platformID, uri);
             }
         });
         
         Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
         OCL.initialize(null);
         NotationPackage.eINSTANCE.eClass();
         StylePackage.eINSTANCE.eClass();
         TextualCommonsPackage.eINSTANCE.eClass();
         org.eclipse.papyrus.infra.gmfdiag.style.StylePackage.eINSTANCE.eClass();
         
         @SuppressWarnings("unchecked")
List<UnitResolverFactory> fFactories = (List<UnitResolverFactory>) 
                 FieldUtils.readField(UnitResolverFactory.Registry.INSTANCE, "fFactories", true);
         fFactories.clear();
         fFactories.add(new MockUnitResolverFactory(new ArrayList<>(baseURIs)));
         
         BlackboxRegistry.INSTANCE.registerModule(CooperateLibrary.class,
                 "de.cooperateproject.qvtoutils.CooperateLibrary", "CooperateLibrary",
                 new String[] { EcorePackage.eNS_URI });
     }
 }
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:37,代码来源:TransformationTestBase.java

示例7: tryConfig

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
private synchronized boolean tryConfig(final ServletConfig config, final String location) {
    final String path = StroomProperties.replaceProperties(location);

    logInfo("tryConfig() - " + location + " -> " + path);

    final Resource resource = StroomResourceLoaderUtil.getResource(resourceLoader, path);
    boolean existingFile = false;
    try {
        logInfo("tryConfig() - " + resource + " exists = " + resource.exists() + " url = " + resource.getURI());
        existingFile = resource.exists() && ResourceUtils.isFileURL(resource.getURL());

    } catch (final Exception ex) {
        logError("tryConfig() - " + ex.getMessage());
    }
    if (existingFile) {
        BasicConfigurator.resetConfiguration();
        Log4jWebConfigurer.initLogging(config.getServletContext(), resource);
        logInfo("tryConfig() - Started log4j using: " + path + " (" + resource.getFilename() + ")");

        logger = StroomLogger.getLogger(Log4JServlet.class);
        logger.info("tryConfig() - Started log4j using: " + path + " (" + resource.getFilename() + ")");

        boolean redirectSystemOut = true;
        final Enumeration<?> allApenders = Logger.getRootLogger().getAllAppenders();
        while (allApenders.hasMoreElements()) {
            final Appender appender = (Appender) allApenders.nextElement();
            if (appender.getClass().getName().contains("Console")) {
                redirectSystemOut = false;
            }
        }

        if (redirectSystemOut) {
            System.setErr(LoggerPrintStream.create(logger, true));
            System.setOut(LoggerPrintStream.create(logger, true));
        }

        return true;
    } else {
        logInfo("tryConfig() - Not found: " + path);
    }

    return false;
}
 
开发者ID:gchq,项目名称:stroom-proxy,代码行数:44,代码来源:Log4JServlet.java

示例8: setUp

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    BasicConfigurator.resetConfiguration();
    BasicConfigurator.configure();
    Logger.getLogger(ProbablisticSelectionManager.class).setLevel(Level.DEBUG);
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:7,代码来源:ProbabilisticSelectionManagerTest.java

示例9: tearDown

import org.apache.log4j.BasicConfigurator; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
   broker.stop();
   BasicConfigurator.resetConfiguration();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:6,代码来源:LostScheduledMessagesTest.java


注:本文中的org.apache.log4j.BasicConfigurator.resetConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。