本文整理汇总了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();
}