Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to override default log4j properties

Highlighted

How to override default log4j properties

present we are using hadoop.root.logger="INFO,console" for mapreduce ans spark jobs. I wanna override with "WARN,console" , I tried to set global variable export HADOOP_ROOT_LOGGER="WARN,console" in hadoop_env.sh but its not working . i can see info,warn,error in yarn log. how can i override these settings.

2 REPLIES 2
Highlighted

Re: How to override default log4j properties

Super Mentor

@jayaprakash gadi

If you are using Ambari to start and stop your services then you should make changes via ambari "hadoop-env.sh" instead, Else it will override your System level (global setting) while starting the process.

For spark executor you can also pass your own log4j.properties as well:

https://community.hortonworks.com/questions/36027/log4jproperties-override-spark-executor.html

.

Re: How to override default log4j properties

New Contributor

hi i have a simple oozie shell action to echo "hell o world", I am trying to over ride the oozie shell action logging Please let me know how this can be achieved

I tried setting the map reduce properties of shell action still it does not work

I have a bash script like this

bash

--------------------------

#!/bin/bash

echo "log4j logger checking the target" # End of script tasks, returning error code

I added the following property in workflow and i tried to execute

<code><property>
      <name>mapred.child.java.opts</name>
      <value>-Dlog4j.configuration=${log4jConfig}</value>
 </property>

the log4j content is similar to this

log4j.rootLogger=${hadoop.root.logger} hadoop.root.logger=INFO,oozie log4j.appender.oozie=org.apache.log4j.ConsoleAppender log4j.appender.oozie.target=System.err log4j.appender.oozie.layout=org.apache.log4j.PatternLayout log4j.appender.oozie.layout.ConversionPattern=[%p] %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [sds-to-hdfs][%c] %m%n

I want to change the logging target to System.out just to check if the log4j is overirdden

But still the log4j is not overriden please let me know if there is smothing wrong

Don't have an account?
Coming from Hortonworks? Activate your account here