use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class Log4j2LoggerSelfTest method testPathConstructor.
/**
* @throws Exception If failed.
*/
public void testPathConstructor() throws Exception {
IgniteLogger log = new Log4J2Logger(LOG_PATH_TEST).getLogger(getClass());
((LoggerNodeIdAware) log).setNodeId(UUID.randomUUID());
checkLog(log);
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class GridLog4j2InitializedTest method testLogInitialize.
/** */
public void testLogInitialize() {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("grid" + 1);
cfg.setNodeId(new UUID(1, 1));
// cfg.setIgniteHome("/home/glutters/Documenti/apache-ignite/ignite-master/ignite/");
URL xml = U.resolveIgniteUrl("config/ignite-log4j2.xml");
IgniteLogger log;
try {
log = new Log4J2Logger(xml);
// log.isQuiet();
cfg.setGridLogger(log);
} catch (IgniteCheckedException e) {
e.printStackTrace();
return;
}
assert log.isInfoEnabled() == true;
if (log.isDebugEnabled())
log.debug("This is 'debug' message.");
log.info("This is 'info' message.");
log.warning("This is 'warning' message.");
log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
log.error("This is 'error' message.");
assert log.getLogger(GridLog4j2InitializedTest.class.getName()) instanceof Log4J2Logger;
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class Log4j2LoggerSelfTest method testUrlConstructor.
/**
* @throws Exception If failed.
*/
public void testUrlConstructor() throws Exception {
File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_TEST);
assert xml != null;
assert xml.exists();
IgniteLogger log = new Log4J2Logger(xml.toURI().toURL()).getLogger(getClass());
((LoggerNodeIdAware) log).setNodeId(UUID.randomUUID());
checkLog(log);
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class GridLog4jNotInitializedTest method testLogInitialize.
/** */
public void testLogInitialize() {
IgniteLogger log = new Log4JLogger().getLogger(GridLog4jNotInitializedTest.class);
if (log.isDebugEnabled())
log.debug("This is 'debug' message.");
else
System.out.println("DEBUG level is not enabled.");
if (log.isInfoEnabled())
log.info("This is 'info' message.");
else
System.out.println("INFO level is not enabled.");
log.warning("This is 'warning' message.");
log.error("This is 'error' message.");
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class HadoopExternalProcessStarter method run.
/**
* Run the process.
*
* @throws Exception If failed.
*/
public void run() throws Exception {
File outputDir = outputDirectory();
initializeStreams(outputDir);
ExecutorService msgExecSvc = Executors.newFixedThreadPool(Integer.getInteger("MSG_THREAD_POOL_SIZE", Runtime.getRuntime().availableProcessors() * 2));
IgniteLogger log = logger(outputDir);
HadoopExternalCommunication comm = new HadoopExternalCommunication(args.nodeId, args.childProcId, new JdkMarshaller(), log, msgExecSvc, "external", args.workDir);
comm.start();
HadoopProcessDescriptor nodeDesc = new HadoopProcessDescriptor(args.nodeId, args.parentProcId);
nodeDesc.address(args.addr);
nodeDesc.tcpPort(args.tcpPort);
nodeDesc.sharedMemoryPort(args.shmemPort);
HadoopChildProcessRunner runner = new HadoopChildProcessRunner();
runner.start(comm, nodeDesc, msgExecSvc, log);
System.err.println("Started");
System.err.flush();
System.setOut(new PrintStream(out));
System.setErr(new PrintStream(err));
}
Aggregations