當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。