%sh

#!/bin/bash
echo "Executing on Driver: $DB_IS_DRIVER"
if [[ $DB_IS_DRIVER = "TRUE" ]]; then
LOG4J_PATH="/home/ubuntu/databricks/spark/dbconf/log4j/driver/log4j.properties"
else
LOG4J_PATH="/home/ubuntu/databricks/spark/dbconf/log4j/executor/log4j.properties"
fi
echo "Adjusting log4j.properties here: ${LOG4J_PATH}"
echo "log4j.rootCategory=WARN, console" >> ${LOG4J_PATH}

echo "log4j.logger.com.bigenius-x.application=INFO, com.bigenius-x.application" >> ${LOG4J_PATH}
# don't write the logs into the root logger 
echo "log4j.additivity.com.bigenius-x.application=false" >> ${LOG4J_PATH}

echo "log4j.appender.com.bigenius-x.application=org.apache.log4j.ConsoleAppender" >> ${LOG4J_PATH}
echo "log4j.appender.com.bigenius-x.application.target=System.out" >> ${LOG4J_PATH}
echo "log4j.appender.com.bigenius-x.application.layout=org.apache.log4j.PatternLayout" >> ${LOG4J_PATH}