You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by lihu <li...@gmail.com> on 2014/03/11 04:36:34 UTC

how to use the log4j for the standalone app

Hi,
   I use the spark0.9, and when i run the spark-shell, I can log property
according the log4j.properties in the SPARK_HOME/conf directory.But when I
use the standalone app, I do not know how to log it.

  I use the SparkConf to set it, such as:

  *val conf = new SparkConf()*
*  conf.set("*log4j.configuration*", "/home/hadoop/spark/conf/l*
*og4j.properties**")*

  but it does not work.

  this question maybe simple, but I can not find anything in the web. and I
think this maybe helpful for many people who do not familiar with spark.

Re: how to use the log4j for the standalone app

Posted by lihu <li...@gmail.com>.
Thanks, but I do not to log myself program info, I just do not want spark
output all the info to my console, I want the spark output the log into to
some file which I specified.



On Tue, Mar 11, 2014 at 11:49 AM, Robin Cjc <cj...@gmail.com> wrote:

> Hi lihu,
>
> you can extends the org.apache.spark.logging class. Then use the function
> like logInfo(). Then will log according to the config in your
> log4j.properties.
>
> Best Regards,
> Chen Jingci
>
>
> On Tue, Mar 11, 2014 at 11:36 AM, lihu <li...@gmail.com> wrote:
>
>> Hi,
>>    I use the spark0.9, and when i run the spark-shell, I can log property
>> according the log4j.properties in the SPARK_HOME/conf directory.But when I
>> use the standalone app, I do not know how to log it.
>>
>>   I use the SparkConf to set it, such as:
>>
>>   *val conf = new SparkConf()*
>> *  conf.set("*log4j.configuration*", "/home/hadoop/spark/conf/l*
>> *og4j.properties**")*
>>
>>   but it does not work.
>>
>>   this question maybe simple, but I can not find anything in the web. and
>> I think this maybe helpful for many people who do not familiar with spark.
>>
>>
>


-- 
*Best Wishes!*

*Li Hu(李浒) | Graduate Student*

*Institute for Interdisciplinary Information Sciences(IIIS
<http://iiis.tsinghua.edu.cn/>)*
*Tsinghua University, China*

*Email: lihu723@gmail.com <li...@gmail.com>*
*Tel  : +86 15120081920*
*Homepage: http://iiis.tsinghua.edu.cn/zh/lihu/
<http://iiis.tsinghua.edu.cn/zh/lihu/>*

Re: how to use the log4j for the standalone app

Posted by Robin Cjc <cj...@gmail.com>.
Hi lihu,

you can extends the org.apache.spark.logging class. Then use the function
like logInfo(). Then will log according to the config in your
log4j.properties.

Best Regards,
Chen Jingci


On Tue, Mar 11, 2014 at 11:36 AM, lihu <li...@gmail.com> wrote:

> Hi,
>    I use the spark0.9, and when i run the spark-shell, I can log property
> according the log4j.properties in the SPARK_HOME/conf directory.But when I
> use the standalone app, I do not know how to log it.
>
>   I use the SparkConf to set it, such as:
>
>   *val conf = new SparkConf()*
> *  conf.set("*log4j.configuration*", "/home/hadoop/spark/conf/l*
> *og4j.properties**")*
>
>   but it does not work.
>
>   this question maybe simple, but I can not find anything in the web. and
> I think this maybe helpful for many people who do not familiar with spark.
>
>