Spark: Separate spark logs from custom logs
<p>I am trying to build an application that uses log4j to make log files. The location of the log file is provided throught <strong><em>log4j.properties</em></strong> file.</p>

<p>So far, it works well but I want to separate the spark logs from the logs that I generate from my code. Or at least just print my log messages in the log file.</p>

<p>Is there any way to do that?</p>

<p>log4j.properties</p>

<pre><code># Root logger option
log4j.rootLogger=INFO, stdout, file
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

# Redirect log messages to a log file
log4j.appender.file=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.file.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
log4j.appender.file.rollingPolicy.fileNamePattern=../log/abc%d{yyyyMMdd_HHmmss}.log
    log4j.appender.file.TriggeringPolicy=org.apache.log4j.rolling.SizeBasedTriggeringPolicy
log4j.appender.file.TriggeringPolicy.maxFileSize=5000000
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
</code></pre>