本文整理匯總了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);
}
示例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);
}
示例3: after
import org.apache.log4j.BasicConfigurator; //導入方法依賴的package包/類
@Override
public void after() {
if (!notConfigured) {
logger.info("Reset basic Log4J configuration...");
BasicConfigurator.resetConfiguration();
notConfigured = true;
}
}
示例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();
}
示例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();
}
示例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 });
}
}
示例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;
}
示例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);
}
示例9: tearDown
import org.apache.log4j.BasicConfigurator; //導入方法依賴的package包/類
@After
public void tearDown() throws Exception {
broker.stop();
BasicConfigurator.resetConfiguration();
}