use of org.apache.ignite.logger.log4j.Log4JLogger in project ignite by apache.
the class HadoopExternalProcessStarter method logger.
/**
* @param outputDir Directory for process output.
* @return Logger.
*/
private IgniteLogger logger(final File outputDir) {
final URL url = U.resolveIgniteUrl(DFLT_LOG4J_CONFIG);
Log4JLogger logger;
try {
logger = url != null ? new Log4JLogger(url) : new Log4JLogger(true);
} catch (IgniteCheckedException e) {
System.err.println("Failed to create URL-based logger. Will use default one.");
e.printStackTrace();
logger = new Log4JLogger(true);
}
logger.updateFilePath(new IgniteClosure<String, String>() {
@Override
public String apply(String s) {
return new File(outputDir, args.childProcId + ".log").getAbsolutePath();
}
});
return logger;
}
use of org.apache.ignite.logger.log4j.Log4JLogger in project ignite by apache.
the class GridifySingleSplitLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
/* Uncomment following code if you start it manually. */
CommunicationSpi commSpi = new TcpCommunicationSpi();
cfg.setCommunicationSpi(commSpi);
DiscoverySpi discoSpi = new TcpDiscoverySpi();
cfg.setDiscoverySpi(discoSpi);
/*
*/
@SuppressWarnings("TypeMayBeWeakened") Log4JLogger log = (Log4JLogger) cfg.getGridLogger();
log.getLogger("org.apache.ignite").setLevel(Level.INFO);
return cfg;
}
use of org.apache.ignite.logger.log4j.Log4JLogger in project ignite by apache.
the class TcpRouterMultiNodeSelfTest method routerConfiguration.
/**
* @param i Number of router. Used to avoid configuration conflicts.
* @return Router configuration.
* @throws IgniteCheckedException If failed.
*/
private GridTcpRouterConfiguration routerConfiguration(int i) throws IgniteCheckedException {
GridTcpRouterConfiguration cfg = new GridTcpRouterConfiguration();
cfg.setHost(HOST);
cfg.setPort(ROUTER_TCP_PORT_BASE + i);
cfg.setPortRange(0);
cfg.setServers(Collections.singleton(HOST + ":" + REST_TCP_PORT_BASE));
cfg.setLogger(new Log4JLogger(ROUTER_LOG_CFG));
return cfg;
}
use of org.apache.ignite.logger.log4j.Log4JLogger in project ignite by apache.
the class CacheStoreHelper method createCacheStore.
/**
*/
public static CacheStore createCacheStore(String cacheName, Resource persistenceSettings, DataSource conn, CacheStoreSession session, Logger log) {
CassandraCacheStore<Integer, Integer> cacheStore = new CassandraCacheStore<>(conn, new KeyValuePersistenceSettings(persistenceSettings), Runtime.getRuntime().availableProcessors());
try {
Field sesField = CassandraCacheStore.class.getDeclaredField("storeSes");
Field logField = CassandraCacheStore.class.getDeclaredField("log");
sesField.setAccessible(true);
logField.setAccessible(true);
sesField.set(cacheStore, session != null ? session : new TestCacheSession(cacheName));
logField.set(cacheStore, new Log4JLogger(log));
} catch (Throwable e) {
throw new RuntimeException("Failed to initialize test Ignite cache store", e);
}
return cacheStore;
}
use of org.apache.ignite.logger.log4j.Log4JLogger in project ignite by apache.
the class CassandraHelper method startEmbeddedCassandra.
/**
*/
public static void startEmbeddedCassandra(Logger log) {
ClassLoader clsLdr = CassandraHelper.class.getClassLoader();
URL url = clsLdr.getResource(EMBEDDED_CASSANDRA_YAML);
embeddedCassandraBean = new CassandraLifeCycleBean();
embeddedCassandraBean.setCassandraConfigFile(url.getFile());
try {
Field logField = CassandraLifeCycleBean.class.getDeclaredField("log");
logField.setAccessible(true);
logField.set(embeddedCassandraBean, new Log4JLogger(log));
} catch (Throwable e) {
throw new RuntimeException("Failed to initialize logger for CassandraLifeCycleBean", e);
}
embeddedCassandraBean.onLifecycleEvent(LifecycleEventType.BEFORE_NODE_START);
}
Aggregations