You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@samza.apache.org by Jordi Blasi Uribarri <jb...@nextel.es> on 2015/08/04 09:44:18 UTC

log4j configuration

Hi,

I guess this is just a howto question, but I am not able to find how it works. I am trying to trace the code of the job I want to execute in Samza. I have defined the environment variable as stated in the documentation:
export SAMZA_LOG_DIR=/opt/logs

I believe that this is working as I have seen that the garbage collector correctly generates the gc.o file and writes to it. The directories exists in all samza servers (two in my lab).

I have added the following code to the job:

Logger logger = Logger.getLogger(GetConfig.class);
logger.info("Trace text message");

Although the code is being executed (I can see the messages going through) I see no trace written. I don’t have experience with log4j and maybe it is there where I have to look but, I am missing something?

Thanks,

                Jordi
________________________________
Jordi Blasi Uribarri
Área I+D+i

jblasi@nextel.es
Oficina Bilbao

[http://www.nextel.es/wp-content/uploads/Firma_Nextel_2015.png]

Re: log4j configuration

Posted by Yan Fang <ya...@gmail.com>.
Hi Jordi,

This is a little tricky. :)

1. If you want to specify the logs to specific locations, please use the
following two properties, such as

*task.opts*=-Dsamza.log.dir=/tmp/samza-logs
*yarn.am.opts*=-Dsamza.log.dir=/tmp/samza-master-logs

2. then why doesn't export SAMZA_LOG_DIR work?

Because this setting only takes effect in your host machine. When you
submit the job, AM and containers do not inherit the environment variables
from their host.

3. then why can you still see the gc logs?

Though this variable does not affect AM and containers, it is used by the
YarnClient, which is used to submit the job. So essentially the gc log is
for the YarnClient (it dies after submitting). The log of YarnClient is
taken care by the* /bin/log4j-console.xml* file, not lib/log4j.xml (this
one is for the AM and all containers).

Hope this makes you a little clear.

Thanks,






Fang, Yan
yanfang724@gmail.com

On Tue, Aug 4, 2015 at 12:44 AM, Jordi Blasi Uribarri <jb...@nextel.es>
wrote:

> Hi,
>
> I guess this is just a howto question, but I am not able to find how it
> works. I am trying to trace the code of the job I want to execute in Samza.
> I have defined the environment variable as stated in the documentation:
> export SAMZA_LOG_DIR=/opt/logs
>
> I believe that this is working as I have seen that the garbage collector
> correctly generates the gc.o file and writes to it. The directories exists
> in all samza servers (two in my lab).
>
> I have added the following code to the job:
>
> Logger logger = Logger.getLogger(GetConfig.class);
> logger.info("Trace text message");
>
> Although the code is being executed (I can see the messages going through)
> I see no trace written. I don’t have experience with log4j and maybe it is
> there where I have to look but, I am missing something?
>
> Thanks,
>
>                 Jordi
> ________________________________
> Jordi Blasi Uribarri
> Área I+D+i
>
> jblasi@nextel.es
> Oficina Bilbao
>
> [http://www.nextel.es/wp-content/uploads/Firma_Nextel_2015.png]
>