ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prachi Garg <pg...@gridgain.com>
Subject Re: How to configure ignite-jcl and Ignite-slf4j logger
Date Fri, 01 Sep 2017 17:43:25 GMT
Nikolai,

I have specified 'gridlogger' property in 'IgniteConfiguration', but looks
like it does not get instantiated.

<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">

    <property name="gridLogger">
        <bean class="org.apache.ignite.logger.jcl.JclLogger">
            <constructor-arg type="org.apache.commons.logging.Log">
                <bean class="org.apache.commons.logging.impl.Log4JLogger">
                    <constructor-arg type="java.lang.String"
value="/Users/prachig/myexamples/config/ignite-log4j.xml"/>
                </bean>
            </constructor-arg>
        </bean>
    </property>

    <!-- Other configurations -->
    ...

</bean>




On Fri, Sep 1, 2017 at 10:16 AM, Nikolay Tikhonov <ntikhonov@gridgain.com>
wrote:

> Hi Denis,
>
> JCL it's wrapper for logging system (similar sl4j) which can be used
> together with log4j. I guess that JavaDoc correct.
>
> On Fri, Sep 1, 2017 at 5:40 PM, Denis Magda <dmagda@apache.org> wrote:
>
> > Nikolai,
> >
> > Looking at JCL documentation I see the usage of Log4j together with JCL:
> >
> > * <pre name="code" class="xml">
> > *      ...
> > *      &lt;property name="gridLogger"&gt;
> > *          &lt;bean class="org.apache.ignite.logger.jcl.JclLogger"&gt;
> > *              &lt;constructor-arg type="org.apache.commons.
> > logging.Log"&gt;
> > *                  &lt;bean class="org.apache.commons.
> > logging.impl.Log4JLogger"&gt;
> > *                      &lt;constructor-arg type="java.lang.String"
> > value="config/ignite-log4j.xml"/&gt;
> > *                  &lt;/bean&gt;
> > *              &lt;/constructor-arg&gt;
> > *          &lt;/bean&gt;
> > *      &lt;/property&gt;
> > *      ...
> > * </pre>
> >
> >
> > or
> >
> > * And the same configuration if you'd like to configure Ignite in your
> > code:
> > * <pre name="code" class="java">
> > *      IgniteConfiguration cfg = new IgniteConfiguration();
> > *      ...
> > *      IgniteLogger log = new JclLogger(new Log4JLogger("config/ignite-
> > log4j.xml"));
> > *      ...
> > *      cfg.setGridLogger(log);
> > * </pre>
> >
> >
> > Is it wrong? Could you fix the Java Doc in a proper way?
> >
> >
> > > On Sep 1, 2017, at 3:12 AM, Nikolai Tikhonov <ntikhonov@apache.org>
> > wrote:
> > >
> > > Hello Prachi!
> > >
> > > You need to set gridLogger property in IgniteConfiguration and remove
> > ignite-log4j dependency from POM file.
> > >
> > > For example for Sl4j logger:
> > >
> > > igniteConfiguration.setGridLogger(new Slf4jLogger());
> > >
> > > and for Jc logger:
> > >
> > > igniteConfiguration.setGridLogger(new JclLogger());
> > >
> > > On Fri, Sep 1, 2017 at 2:44 AM, Prachi Garg <pgarg@gridgain.com
> <mailto:
> > pgarg@gridgain.com>> wrote:
> > > Engineers,
> > >
> > > In the attempt to document loggers supported by Ignite, I am having a
> > hard
> > > time configuring ignite-jcl and ignite-slf4j (I could configure log4j
> and
> > > log4j2). I don't see the log message on my console when I use
> ignite-jcl
> > or
> > > ignite-slf4j.
> > >
> > >  Below is the configuration and sample code I am using:
> > >
> > > *ignite-log4j.xml*
> > >
> > > <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> > > <log4j:configuration debug="true"
> > > xmlns:log4j='http://jakarta.apache.org/log4j/ <
> > http://jakarta.apache.org/log4j/>'>
> > >
> > >     <appender name="console" class="org.apache.log4j.ConsoleAppender">
> > >         <param name="Target" value="System.out"/>
> > >         <layout class="org.apache.log4j.PatternLayout">
> > >             <param name="ConversionPattern" value="%d{yyyy-MM-dd
> > > HH:mm:ss} %-5p %c{1}:%L - %m%n" />
> > >         </layout>
> > >     </appender>
> > >
> > >     <root>
> > >         <priority value ="info"></priority>
> > >         <appender-ref ref="console"></appender-ref>
> > >     </root>
> > >
> > > </log4j:configuration>
> > >
> > >
> > > *Maven dependency -*
> > >
> > > <dependency>
> > >     <groupId>org.apache.ignite</groupId>
> > >     <artifactId>ignite-log4j</artifactId>
> > >     <version>2.1.0</version>
> > > </dependency>
> > >
> > > <dependency>
> > >     <groupId>org.apache.ignite</groupId>
> > >     <artifactId>ignite-jcl</artifactId>
> > >     <version>2.1.0</version>
> > > </dependency>
> > >
> > >
> > > *Configuration for JCL ( as specified in javadoc)- *
> > >
> > > <property name="gridLogger">
> > >     <bean class="org.apache.ignite.logger.jcl.JclLogger">
> > >         <constructor-arg type="org.apache.commons.logging.Log">
> > >             <bean class="org.apache.commons.logging.impl.Log4JLogger">
> > >                 <constructor-arg type="java.lang.String"
> > > value="/Users/prachig/myexamples/config/ignite-log4j.xml"/>
> > >             </bean>
> > >         </constructor-arg>
> > >     </bean>
> > > </property>
> > >
> > >
> > > *Sample code I am using- *
> > >
> > > public class LoggerExample {
> > >     public static void main(String[] args) throws IgniteException {
> > >         try (Ignite ignite =
> > > Ignition.start("/Users/prachig/myexamples/config/cluster-config.xml"))
> > > {
> > >             ignite.log().info("Info Message 1 Logged !!!");
> > >             ignite.log().info("Info Message 2 Logged !!!");
> > >
> > >             System.out.println(ignite.log().getClass());
> > >         }
> > >     }
> > > }
> > >
> > > *Output*
> > >
> > > /Library/Java/JavaVirtualMachines/jdk1.8.0_
> 74.jdk/Contents/Home/bin/java
> > > -Didea.launcher.port=7535
> > > "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA
> > > CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath
> > > "/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/
> > deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/
> > Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/
> > lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.
> > 8.0_74.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/
> > Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/
> > lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.
> > 8.0_74.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/
> > ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/
> > ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/
> > Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/
> > lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.
> > 8.0_74.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/
> > jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/
> > jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/
> > management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.
> > 8.0_74.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/
> > resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/ant-
> > javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/lib/dt.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/
> > javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/
> > packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> > 74.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/
> > JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/
> > tools.jar:/Users/prachig/myexamples/target/classes:/
> > Users/prachig/.m2/repository/org/apache/ignite/ignite-core/
> > 2.1.0/ignite-core-2.1.0.jar:/Users/prachig/.m2/repository/
> > javax/cache/cache-api/1.0.0/cache-api-1.0.0.jar:/Users/
> > prachig/.m2/repository/org/jetbrains/annotations/13.0/
> > annotations-13.0.jar:/Users/prachig/.m2/repository/org/
> > gridgain/ignite-shmem/1.0.0/ignite-shmem-1.0.0.jar:/Users/
> > prachig/.m2/repository/org/apache/ignite/ignite-spring/2.
> > 1.0/ignite-spring-2.1.0.jar:/Users/prachig/.m2/repository/
> > org/apache/ignite/ignite-indexing/2.1.0/ignite-
> indexing-2.1.0.jar:/Users/
> > prachig/.m2/repository/commons-codec/commons-codec/1.
> > 6/commons-codec-1.6.jar:/Users/prachig/.m2/repository/
> > org/apache/lucene/lucene-core/5.5.2/lucene-core-5.5.2.jar:/
> > Users/prachig/.m2/repository/org/apache/lucene/lucene-
> > analyzers-common/5.5.2/lucene-analyzers-common-5.5.2.jar:/
> > Users/prachig/.m2/repository/org/apache/lucene/lucene-
> > queryparser/5.5.2/lucene-queryparser-5.5.2.jar:/Users/
> > prachig/.m2/repository/org/apache/lucene/lucene-queries/
> > 5.5.2/lucene-queries-5.5.2.jar:/Users/prachig/.m2/
> > repository/org/apache/lucene/lucene-sandbox/5.5.2/lucene-
> > sandbox-5.5.2.jar:/Users/prachig/.m2/repository/com/
> > h2database/h2/1.4.195/h2-1.4.195.jar:/Users/prachig/.m2/repository/org/
> > springframework/spring-core/4.3.7.RELEASE/spring-core-4.3.7.
> > RELEASE.jar:/Users/prachig/.m2/repository/commons-logging/
> > commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/
> > prachig/.m2/repository/org/springframework/spring-aop/4.
> > 3.7.RELEASE/spring-aop-4.3.7.RELEASE.jar:/Users/prachig/.
> > m2/repository/org/springframework/spring-beans/
> > 4.3.7.RELEASE/spring-beans-4.3.7.RELEASE.jar:/Users/
> > prachig/.m2/repository/org/springframework/spring-
> > context/4.3.7.RELEASE/spring-context-4.3.7.RELEASE.jar:/
> > Users/prachig/.m2/repository/org/springframework/spring-
> > expression/4.3.7.RELEASE/spring-expression-4.3.7.
> > RELEASE.jar:/Users/prachig/.m2/repository/org/
> > springframework/spring-tx/4.3.7.RELEASE/spring-tx-4.3.7.
> > RELEASE.jar:/Users/prachig/.m2/repository/org/
> > springframework/spring-jdbc/4.3.7.RELEASE/spring-jdbc-4.3.7.
> > RELEASE.jar:/Users/prachig/.m2/repository/org/apache/
> > ignite/ignite-log4j2/2.1.0/ignite-log4j2-2.1.0.jar:/
> > Users/prachig/.m2/repository/org/apache/logging/log4j/
> > log4j-api/2.8.1/log4j-api-2.8.1.jar:/Users/prachig/.m2/
> > repository/org/apache/logging/log4j/log4j-core/2.8.1/log4j-
> > core-2.8.1.jar:/Users/prachig/.m2/repository/org/apache/
> > ignite/ignite-log4j/2.1.0/ignite-log4j-2.1.0.jar:/Users/
> > prachig/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:
> > /Users/prachig/.m2/repository/org/apache/ignite/ignite-jcl/
> > 2.1.0/ignite-jcl-2.1.0.jar:/Users/prachig/.m2/repository/
> > org/apache/ignite/ignite-slf4j/2.1.0/ignite-slf4j-2.1.
> > 0.jar:/Users/prachig/.m2/repository/org/slf4j/slf4j-
> > api/1.7.7/slf4j-api-1.7.7.jar:/Users/prachig/.m2/repository/
> > mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.
> > 6.jar:/Users/prachig/.m2/repository/net/spy/spymemcached/2.11.7/
> > spymemcached-2.11.7.jar:/Applications/IntelliJ
> > > IDEA CE.app/Contents/lib/idea_rt.jar"
> > > com.intellij.rt.execution.application.AppMain
> > > ignite.myexamples.LoggerExample
> > > log4j:WARN No appenders could be found for logger
> > > (org.apache.ignite.internal.util.typedef.G).
> > > log4j:WARN Please initialize the log4j system properly.
> > > log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig <
> > http://logging.apache.org/log4j/1.2/faq.html#noconfig>
> > > for more info.
> > > [15:59:49]    __________  ________________
> > > [15:59:49]   /  _/ ___/ |/ /  _/_  __/ __/
> > > [15:59:49]  _/ // (7 7    // /  / / / _/
> > > [15:59:49] /___/\___/_/|_/___/ /_/ /___/
> > > [15:59:49]
> > > [15:59:49] ver. 2.1.0#20170720-sha1:a6ca5c8a
> > > [15:59:49] 2017 Copyright(C) Apache Software Foundation
> > > [15:59:49]
> > > [15:59:49] Ignite documentation: http://ignite.apache.org <
> > http://ignite.apache.org/>
> > > [15:59:49]
> > > [15:59:49] Quiet mode.
> > > [15:59:49]   ^-- To see **FULL** console log here add
> > > -DIGNITE_QUIET=false or "-v" to ignite.{sh|bat}
> > > [15:59:49]
> > > [15:59:49] OS: Mac OS X 10.12.1 x86_64
> > > [15:59:49] VM information: Java(TM) SE Runtime Environment
> > > 1.8.0_74-b02 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM
> > > 25.74-b02
> > > [15:59:49] Initial heap size is 256MB (should be no less than 512MB,
> > > use -Xms512m -Xmx512m).
> > > [15:59:49] Configured plugins:
> > > [15:59:49]   ^-- None
> > > [15:59:49]
> > > [15:59:49] Message queue limit is set to 0 which may lead to potential
> > > OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC
> > > modes due to message queues growth on sender and receiver sides.
> > > [15:59:49] Security status [authentication=off, tls/ssl=off]
> > > Aug 31, 2017 3:59:49 PM java.util.logging.LogManager$RootLogger log
> > > SEVERE: Failed to resolve default logging config file:
> > > config/java.util.logging.properties
> > > [15:59:50] Performance suggestions for grid  (fix if possible)
> > > [15:59:50] To disable, set -DIGNITE_PERFORMANCE_
> > SUGGESTIONS_DISABLED=true
> > > [15:59:50]   ^-- Enable G1 Garbage Collector (add '-XX:+UseG1GC' to JVM
> > options)
> > > [15:59:50]   ^-- Specify JVM heap max size (add
> > > '-Xmx<size>[g|G|m|M|k|K]' to JVM options)
> > > [15:59:50]   ^-- Set max direct memory size if getting 'OOME: Direct
> > > buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to
> > > JVM options)
> > > [15:59:50]   ^-- Disable processing of calls to System.gc() (add
> > > '-XX:+DisableExplicitGC' to JVM options)
> > > [15:59:50] Refer to this page for more performance suggestions:
> > > https://apacheignite.readme.io/docs/jvm-and-system-tuning <
> > https://apacheignite.readme.io/docs/jvm-and-system-tuning>
> > > [15:59:50]
> > > [15:59:50] To start Console Management & Monitoring run
> > ignitevisorcmd.{sh|bat}
> > > [15:59:50]
> > > [15:59:50] Ignite node started OK (id=fa20d03b)
> > > [15:59:50] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4,
> > heap=3.6GB]
> > > class org.apache.ignite.internal.GridLoggerProxy
> > > [15:59:50] Ignite node stopped OK [uptime=00:00:00:085]
> > >
> > >
> > >
> > >
> > > How can I make it work?
> > >
> > > -P
> > >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message