I’ve looked at Ignite’s Log4j2Logger. It calls Log4j2’s Configurator when the class is constructed. The problem here is that if you are using Log4j 2 and are logging before Ignite initializes you do not want this behavior. Furthermore, it tries to programmatically create a ConsoleAppender, which is likely you don’t want or need. I am thinking I will create an alternate Logger for Ignite that doesn’t do any of this and submit a PR for it. With that you will just configure Log4j according to the Log4j documentation and these problems will go away. I could add it to Log4j itself but it really doesn’t belong there.
Ralph > On Dec 14, 2017, at 12:00 PM, Ralph Goers <ralph.go...@dslextreme.com> wrote: > > Did you add the status=“DEBUG”? I suspect that log4j is being initialized > before ignite starts and then Ignite is trying to reconfigure it. Previously > you had no log4j2.xml so the initial configuration failed but Ignite’s > probably worked. Once you moved the file the initial configuration worked but > Ignite was unable to configure logging. Personally, I have my own version of > Log4j2Logger that only routes ignites logging calls to Log4j and does none of > the extra stuff. In that case you just configure Log4j “normally” and this > problem doesn’t occur. I’ll take a look at the Ignite code and try to > determine why it is having these problems. > > Ralph > >> On Dec 14, 2017, at 11:27 AM, sherryhw <shishuang...@gmail.com> wrote: >> >> I moved the log4j2.xml into the resources folder now. >> --resources >> |--config >> |--data-node-config.xml >> |--log4j2.xml >> >> Now when I start the data-node, the spring log file is fine at first, can >> printout the debug mode of spring log, however, it still fails at Ignite. >> "Exception in thread "main" class org.apache.ignite.IgniteException: Failed >> to instantiate Spring XML application context >> [springUrl=..../target/classes/config/data-node-config.xml, err=Error >> creating bean with name >> 'org.apache.ignite.configuration.IgniteConfiguration#0' defined in URL >> [...target/classes/config/data-node-config.xml]: Cannot create inner bean >> 'org.apache.ignite.logger.log4j2.Log4J2Logger#d2de489' of type >> [org.apache.ignite.logger.log4j2.Log4J2Logger] while setting bean property >> 'gridLogger'; nested exception is >> org.springframework.beans.factory.BeanCreationException: Error creating bean >> with name 'org.apache.ignite.logger.log4j2.Log4J2Logger#d2de489' defined in >> URL [..../target/classes/config/data-node-config.xml]: Bean instantiation >> via constructor failed; nested exception is >> org.springframework.beans.BeanInstantiationException: Failed to instantiate >> [org.apache.ignite.logger.log4j2.Log4J2Logger]: Constructor threw exception; >> nested exception is class org.apache.ignite.IgniteCheckedException: Log4j >> configuration path was not found: /log4j2.xml] >> " >> >> So the issue should be within the ignite trying to configure the log. >> Do you have any ideas how to resolve it? >> If I use absolute path, it could work correctly. >> >> >> >> -- >> Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >> > > >