log4J Configuration Ignored

classic Classic list List threaded Threaded
2 messages Options
keensimo keensimo
Reply | Threaded
Open this post in threaded view
|

log4J Configuration Ignored

Hello,

 

I'm new to Ignite and am trying to setup log4j logging for an Ignite node.

 

I'm adding the dependency as follows:

 

<dependency>

        <groupId>org.apache.ignite</groupId>

        <artifactId>ignite-log4j</artifactId>

        <version>2.7.5</version>

</dependency>   

 

My log 4J is as follows:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="true"

        xmlns:log4j='http://jakarta.apache.org/log4j/'>

 

        <appender name="console" class="org.apache.log4j.ConsoleAppender">

            <layout class="org.apache.log4j.PatternLayout">

               

            </layout>

        </appender>

 

        <root>

                <level value="INFO" />

                <appender-ref ref="console" />

        </root>

 

</log4j:configuration>

 

And I'm starting up the node as follows:

 

public class SampleServerCache {

        public static void main(String[] args) throws IgniteException, IgniteCheckedException {

                CacheConfiguration<String, String> cacheConfiguration = new CacheConfiguration<String, String>();

                cacheConfiguration.setName("sampleCache");

                cacheConfiguration.setStatisticsEnabled(true);

                

                IgniteConfiguration igniteConfiguration = new IgniteConfiguration();

                igniteConfiguration.setCacheConfiguration(cacheConfiguration);

                

                Log4JLogger logger = new Log4JLogger("config/log4j.xml");

                igniteConfiguration.setGridLogger(logger);

 

                Ignition.start(igniteConfiguration);

        }

}

 

However, when I run this the log level is set to DEBUG instead of INFO. I believe the code is finding my log4j.xml because if I rename it an exception is thrown. It seems the configuration is being ignored.

 

Any ideas?

This e-mail and any attachments are confidential and intended solely for the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments.

Internet communications are not guaranteed to be secure or virus-free. The Barclays Group does not accept responsibility for any loss arising from unauthorised access to, or interference with, any Internet communications by any third party, or from the transmission of any viruses. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons.

Any opinion or other information in this e-mail or its attachments that does not relate to the business of the Barclays Group is personal to the sender and is not given or endorsed by the Barclays Group.

Barclays Execution Services Limited provides support and administrative services across Barclays group. Barclays Execution Services Limited is an appointed representative of Barclays Bank UK plc, Barclays Bank plc and Clydesdale Financial Services Limited. Barclays Bank UK plc and Barclays Bank plc are authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority. Clydesdale Financial Services Limited is authorised and regulated by the Financial Conduct Authority.

ibelyakov ibelyakov
Reply | Threaded
Open this post in threaded view
|

Re: log4J Configuration Ignored

Hi,

I've tried to reproduce the issue by using your examples with Ignite 2.7.5 and seems like it works correctly for me. 

On node start I see next information regarding log level:
log4j: Level value for root is  [INFO].
log4j: root level set to INFO

Did you specify IGNITE_HOME property in your environment? If yes then Ignite will try to load config file from ignite home folder at first, and maybe it contains configuration file with different settings.

Regards,
Igor Belyakov

On Wed, Jul 24, 2019 at 5:25 PM <[hidden email]> wrote:

Hello,

 

I'm new to Ignite and am trying to setup log4j logging for an Ignite node.

 

I'm adding the dependency as follows:

 

<dependency>

        <groupId>org.apache.ignite</groupId>

        <artifactId>ignite-log4j</artifactId>

        <version>2.7.5</version>

</dependency>   

 

My log 4J is as follows:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="true"

        xmlns:log4j='http://jakarta.apache.org/log4j/'>

 

        <appender name="console" class="org.apache.log4j.ConsoleAppender">

            <layout class="org.apache.log4j.PatternLayout">

               

            </layout>

        </appender>

 

        <root>

                <level value="INFO" />

                <appender-ref ref="console" />

        </root>

 

</log4j:configuration>

 

And I'm starting up the node as follows:

 

public class SampleServerCache {

        public static void main(String[] args) throws IgniteException, IgniteCheckedException {

                CacheConfiguration<String, String> cacheConfiguration = new CacheConfiguration<String, String>();

                cacheConfiguration.setName("sampleCache");

                cacheConfiguration.setStatisticsEnabled(true);

                

                IgniteConfiguration igniteConfiguration = new IgniteConfiguration();

                igniteConfiguration.setCacheConfiguration(cacheConfiguration);

                

                Log4JLogger logger = new Log4JLogger("config/log4j.xml");

                igniteConfiguration.setGridLogger(logger);

 

                Ignition.start(igniteConfiguration);

        }

}

 

However, when I run this the log level is set to DEBUG instead of INFO. I believe the code is finding my log4j.xml because if I rename it an exception is thrown. It seems the configuration is being ignored.

 

Any ideas?

This e-mail and any attachments are confidential and intended solely for the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments.

Internet communications are not guaranteed to be secure or virus-free. The Barclays Group does not accept responsibility for any loss arising from unauthorised access to, or interference with, any Internet communications by any third party, or from the transmission of any viruses. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons.

Any opinion or other information in this e-mail or its attachments that does not relate to the business of the Barclays Group is personal to the sender and is not given or endorsed by the Barclays Group.

Barclays Execution Services Limited provides support and administrative services across Barclays group. Barclays Execution Services Limited is an appointed representative of Barclays Bank UK plc, Barclays Bank plc and Clydesdale Financial Services Limited. Barclays Bank UK plc and Barclays Bank plc are authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority. Clydesdale Financial Services Limited is authorised and regulated by the Financial Conduct Authority.