Search in sources :

Example 11 with IgniteLogger

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);
}
Also used : IgniteLogger(org.apache.ignite.IgniteLogger) LoggerNodeIdAware(org.apache.ignite.logger.LoggerNodeIdAware)

Example 12 with IgniteLogger

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;
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) UUID(java.util.UUID) IgniteLogger(org.apache.ignite.IgniteLogger) URL(java.net.URL) IgniteCheckedException(org.apache.ignite.IgniteCheckedException)

Example 13 with IgniteLogger

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);
}
Also used : IgniteLogger(org.apache.ignite.IgniteLogger) LoggerNodeIdAware(org.apache.ignite.logger.LoggerNodeIdAware) File(java.io.File)

Example 14 with IgniteLogger

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.");
}
Also used : IgniteLogger(org.apache.ignite.IgniteLogger)

Example 15 with IgniteLogger

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));
}
Also used : PrintStream(java.io.PrintStream) ExecutorService(java.util.concurrent.ExecutorService) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller) HadoopExternalCommunication(org.apache.ignite.internal.processors.hadoop.taskexecutor.external.communication.HadoopExternalCommunication) HadoopProcessDescriptor(org.apache.ignite.internal.processors.hadoop.taskexecutor.external.HadoopProcessDescriptor) IgniteLogger(org.apache.ignite.IgniteLogger) File(java.io.File)

Aggregations

IgniteLogger (org.apache.ignite.IgniteLogger)49 Ignite (org.apache.ignite.Ignite)11 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)11 IOException (java.io.IOException)9 LoggerResource (org.apache.ignite.resources.LoggerResource)9 Map (java.util.Map)6 IgniteInstanceResource (org.apache.ignite.resources.IgniteInstanceResource)6 HashMap (java.util.HashMap)5 UUID (java.util.UUID)5 IgniteException (org.apache.ignite.IgniteException)5 ClusterNode (org.apache.ignite.cluster.ClusterNode)5 File (java.io.File)4 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)4 Callable (java.util.concurrent.Callable)3 GridLoggerProxy (org.apache.ignite.internal.GridLoggerProxy)3 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)3 IgniteKernal (org.apache.ignite.internal.IgniteKernal)3 Nullable (org.jetbrains.annotations.Nullable)3 InvalidObjectException (java.io.InvalidObjectException)2 ArrayList (java.util.ArrayList)2