You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Kamal C <ka...@gmail.com> on 2016/04/16 14:40:21 UTC
How to re-direct Ignite logs to log4j2?
Hi
I'm not able to re-direct the Ignite logs to log4j2. I tried it by
adding the optional `ignite-log4j2` directory to the class path and added
the log4j2.xml. Still, the logs thrown to the console.
Can anyone tell how to re-direct the logs?
--Kamal
Re: How to re-direct Ignite logs to log4j2?
Posted by "ilya.kasnacheev" <il...@gmail.com>.
Hello Sherry!
While you're waiting for the response from topic starter, this link may come
in handy:
https://apacheignite.readme.io/docs/logging#section-log4j2
...path to log4j2.xml should be either absolute or a relative local file
system path, relative to META-INF in classpath, or relative to IGNITE_HOME.
So it seems that you've got three options.
Regards,
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: How to re-direct Ignite logs to log4j2?
Posted by sherryhw <sh...@gmail.com>.
Hi I have a same issue here.
How did you resolve it?
Thanks.
Sherry
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: How to re-direct Ignite logs to log4j2?
Posted by Alexei Scherbakov <al...@gmail.com>.
No, it's not a must, but it's used by Ignite for resolving relative paths
when set.
2016-04-18 9:29 GMT+03:00 Kamal C <ka...@gmail.com>:
> Is IGNITE_HOME environmental variable is must? (In docs, it's stated as
> optional)
>
> With `Log4J2Logger`, I've added the log4j2.xml in my application
> class-path, then it throws:
>
> class org.apache.ignite.IgniteCheckedException: Log4j configuration path
> was not found: log4j2.xml
> at
> org.apache.ignite.logger.log4j2.Log4J2Logger.<init>(Log4J2Logger.java:143)
> at
> com.nmsworks.ignite.examples.servicegrid.server.ServerNode.getIgniteConfig(ServerNode.java:150)
> at
> com.nmsworks.ignite.examples.servicegrid.server.ServerNode.main(ServerNode.java:69)
>
> Similarly, for:
> Ignition.start("conf/ignite/ignite-server.xml");
>
> After adding the environmental variable, the issue resolved.
>
> --Kamal
>
>
> On Mon, Apr 18, 2016 at 10:55 AM, Kamal C <ka...@gmail.com> wrote:
>
>> Alexei,
>>
>> Thanks for your response!
>>
>> I've used slf4j to re-direct the logs
>>
>> IgniteConfiguration cfg = new IgniteConfiguration();
>> ...
>> cfg.setGridLogger(new Slf4jLogger());
>> Ignition.start(cfg);
>>
>> Added the ignite-slf4j-1.5.0.final.jar, slf4j-api-1.7.7.jar and
>> slf4j-log4j12-1.7.6.jar to the classpath
>>
>> --Kamal
>>
>>
>> On Sun, Apr 17, 2016 at 6:03 PM, Alexei Scherbakov <
>> alexey.scherbakoff@gmail.com> wrote:
>>
>>> Hi,
>>>
>>>
>>> For embedded mode you can try something like this:
>>>
>>> IgniteConfiguration cfg = new IgniteConfiguration();
>>> ...
>>> cfg.setGridLogger(new Log4J2Logger(U.resolveIgniteUrl("log4j2.xml",
>>> false)));
>>> Ignition.start(cfg);
>>>
>>> The key point here is to tell Ignite to use Log4J2 implementation for
>>> logging.
>>> Make sure you have log4j2.xml on your classpath.
>>>
>>>
>>> 2016-04-16 15:40 GMT+03:00 Kamal C <ka...@gmail.com>:
>>>
>>>> Hi
>>>>
>>>> I'm not able to re-direct the Ignite logs to log4j2. I tried it by
>>>> adding the optional `ignite-log4j2` directory to the class path and added
>>>> the log4j2.xml. Still, the logs thrown to the console.
>>>>
>>>> Can anyone tell how to re-direct the logs?
>>>>
>>>> --Kamal
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> Best regards,
>>> Alexei Scherbakov
>>>
>>
>>
>
--
Best regards,
Alexei Scherbakov
Re: How to re-direct Ignite logs to log4j2?
Posted by Kamal C <ka...@gmail.com>.
Is IGNITE_HOME environmental variable is must? (In docs, it's stated as
optional)
With `Log4J2Logger`, I've added the log4j2.xml in my application
class-path, then it throws:
class org.apache.ignite.IgniteCheckedException: Log4j configuration path
was not found: log4j2.xml
at
org.apache.ignite.logger.log4j2.Log4J2Logger.<init>(Log4J2Logger.java:143)
at
com.nmsworks.ignite.examples.servicegrid.server.ServerNode.getIgniteConfig(ServerNode.java:150)
at
com.nmsworks.ignite.examples.servicegrid.server.ServerNode.main(ServerNode.java:69)
Similarly, for:
Ignition.start("conf/ignite/ignite-server.xml");
After adding the environmental variable, the issue resolved.
--Kamal
On Mon, Apr 18, 2016 at 10:55 AM, Kamal C <ka...@gmail.com> wrote:
> Alexei,
>
> Thanks for your response!
>
> I've used slf4j to re-direct the logs
>
> IgniteConfiguration cfg = new IgniteConfiguration();
> ...
> cfg.setGridLogger(new Slf4jLogger());
> Ignition.start(cfg);
>
> Added the ignite-slf4j-1.5.0.final.jar, slf4j-api-1.7.7.jar and
> slf4j-log4j12-1.7.6.jar to the classpath
>
> --Kamal
>
>
> On Sun, Apr 17, 2016 at 6:03 PM, Alexei Scherbakov <
> alexey.scherbakoff@gmail.com> wrote:
>
>> Hi,
>>
>>
>> For embedded mode you can try something like this:
>>
>> IgniteConfiguration cfg = new IgniteConfiguration();
>> ...
>> cfg.setGridLogger(new Log4J2Logger(U.resolveIgniteUrl("log4j2.xml",
>> false)));
>> Ignition.start(cfg);
>>
>> The key point here is to tell Ignite to use Log4J2 implementation for
>> logging.
>> Make sure you have log4j2.xml on your classpath.
>>
>>
>> 2016-04-16 15:40 GMT+03:00 Kamal C <ka...@gmail.com>:
>>
>>> Hi
>>>
>>> I'm not able to re-direct the Ignite logs to log4j2. I tried it by
>>> adding the optional `ignite-log4j2` directory to the class path and added
>>> the log4j2.xml. Still, the logs thrown to the console.
>>>
>>> Can anyone tell how to re-direct the logs?
>>>
>>> --Kamal
>>>
>>
>>
>>
>> --
>>
>> Best regards,
>> Alexei Scherbakov
>>
>
>
Re: How to re-direct Ignite logs to log4j2?
Posted by Kamal C <ka...@gmail.com>.
Alexei,
Thanks for your response!
I've used slf4j to re-direct the logs
IgniteConfiguration cfg = new IgniteConfiguration();
...
cfg.setGridLogger(new Slf4jLogger());
Ignition.start(cfg);
Added the ignite-slf4j-1.5.0.final.jar, slf4j-api-1.7.7.jar and
slf4j-log4j12-1.7.6.jar to the classpath
--Kamal
On Sun, Apr 17, 2016 at 6:03 PM, Alexei Scherbakov <
alexey.scherbakoff@gmail.com> wrote:
> Hi,
>
>
> For embedded mode you can try something like this:
>
> IgniteConfiguration cfg = new IgniteConfiguration();
> ...
> cfg.setGridLogger(new Log4J2Logger(U.resolveIgniteUrl("log4j2.xml",
> false)));
> Ignition.start(cfg);
>
> The key point here is to tell Ignite to use Log4J2 implementation for
> logging.
> Make sure you have log4j2.xml on your classpath.
>
>
> 2016-04-16 15:40 GMT+03:00 Kamal C <ka...@gmail.com>:
>
>> Hi
>>
>> I'm not able to re-direct the Ignite logs to log4j2. I tried it by
>> adding the optional `ignite-log4j2` directory to the class path and added
>> the log4j2.xml. Still, the logs thrown to the console.
>>
>> Can anyone tell how to re-direct the logs?
>>
>> --Kamal
>>
>
>
>
> --
>
> Best regards,
> Alexei Scherbakov
>
Re: How to re-direct Ignite logs to log4j2?
Posted by Alexei Scherbakov <al...@gmail.com>.
Hi,
For embedded mode you can try something like this:
IgniteConfiguration cfg = new IgniteConfiguration();
...
cfg.setGridLogger(new Log4J2Logger(U.resolveIgniteUrl("log4j2.xml",
false)));
Ignition.start(cfg);
The key point here is to tell Ignite to use Log4J2 implementation for
logging.
Make sure you have log4j2.xml on your classpath.
2016-04-16 15:40 GMT+03:00 Kamal C <ka...@gmail.com>:
> Hi
>
> I'm not able to re-direct the Ignite logs to log4j2. I tried it by
> adding the optional `ignite-log4j2` directory to the class path and added
> the log4j2.xml. Still, the logs thrown to the console.
>
> Can anyone tell how to re-direct the logs?
>
> --Kamal
>
--
Best regards,
Alexei Scherbakov