<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to generate log files on specific folders in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-generate-log-files-on-specific-folders/m-p/102148#M40987</link>
    <description>&lt;P&gt;Hello! My environments are like below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OS : Windows 11

Spark : spark-4.0.0-preview2-bin-hadoop3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the configuration of spark files 'spark-defaults.conf' and 'log4j2.properties'&lt;/P&gt;&lt;P&gt;spark-defaults.conf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;spark.eventLog.enabled             true
spark.eventLog.dir                 file:///C:/spark-4.0.0-preview2-bin-hadoop3/sparkeventlogs
spark.serializer                   org.apache.spark.serializer.KryoSerializer
spark.driver.memory                5g
spark.yarn.am.memory               1g
spark.executor.instances           1

spark.executor.extraJavaOptions        -Dlog4j.configuration=file:///C:/spark-4.0.0-preview2-bin-hadoop3/conf/log4j.properties
spark.driver.extraJavaOptions        -Dlog4j.configuration=file:///C:/spark-4.0.0-preview2-bin-hadoop3/conf/log4j.properties&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;log4j2.properties&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rootLogger = INFO, console, file
rootLogger.level = info
rootLogger.appenderRef.stdout.ref = console, file
rootLogger.appenderRef.file.ref = FileAppender

appender.file=org.apache.log4j.RollingFileAppender 
appender.file.File=C:/spark-4.0.0-preview2-bin-hadoop3/logs
appender.file.MaxFileSize=10MB 
appender.file.MaxBackupIndex=10 
appender.file.layout=org.apache.log4j.PatternLayout 
appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But log files are not generated on&amp;nbsp;C:/spark-4.0.0-preview2-bin-hadoop3/logs folder. Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Dec 2024 00:23:28 GMT</pubDate>
    <dc:creator>aupres</dc:creator>
    <dc:date>2024-12-15T00:23:28Z</dc:date>
    <item>
      <title>how to generate log files on specific folders</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-generate-log-files-on-specific-folders/m-p/102148#M40987</link>
      <description>&lt;P&gt;Hello! My environments are like below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OS : Windows 11

Spark : spark-4.0.0-preview2-bin-hadoop3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the configuration of spark files 'spark-defaults.conf' and 'log4j2.properties'&lt;/P&gt;&lt;P&gt;spark-defaults.conf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;spark.eventLog.enabled             true
spark.eventLog.dir                 file:///C:/spark-4.0.0-preview2-bin-hadoop3/sparkeventlogs
spark.serializer                   org.apache.spark.serializer.KryoSerializer
spark.driver.memory                5g
spark.yarn.am.memory               1g
spark.executor.instances           1

spark.executor.extraJavaOptions        -Dlog4j.configuration=file:///C:/spark-4.0.0-preview2-bin-hadoop3/conf/log4j.properties
spark.driver.extraJavaOptions        -Dlog4j.configuration=file:///C:/spark-4.0.0-preview2-bin-hadoop3/conf/log4j.properties&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;log4j2.properties&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rootLogger = INFO, console, file
rootLogger.level = info
rootLogger.appenderRef.stdout.ref = console, file
rootLogger.appenderRef.file.ref = FileAppender

appender.file=org.apache.log4j.RollingFileAppender 
appender.file.File=C:/spark-4.0.0-preview2-bin-hadoop3/logs
appender.file.MaxFileSize=10MB 
appender.file.MaxBackupIndex=10 
appender.file.layout=org.apache.log4j.PatternLayout 
appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But log files are not generated on&amp;nbsp;C:/spark-4.0.0-preview2-bin-hadoop3/logs folder. Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2024 00:23:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-generate-log-files-on-specific-folders/m-p/102148#M40987</guid>
      <dc:creator>aupres</dc:creator>
      <dc:date>2024-12-15T00:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate log files on specific folders</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-generate-log-files-on-specific-folders/m-p/102150#M40989</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/85281"&gt;@aupres&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Do you see any failures in spark logs?&lt;/P&gt;
&lt;P&gt;Few things to validate:&lt;/P&gt;
&lt;P class="p1"&gt;It appears that the log files are not being generated in the specified directory due to a misconfiguration in your log4j2.properties fil&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;Check the Appender Configuration:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;Ensure that the appender.file is correctly configured to write logs to the specified directory. The File property should point to the exact file path where you want the logs to be written.&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;appender.file=org.apache.log4j.RollingFileAppender&lt;/P&gt;
&lt;P class="p1"&gt;appender.file.File=C:/spark-4.0.0-preview2-bin-hadoop3/logs/spark.log&lt;/P&gt;
&lt;P class="p1"&gt;appender.file.MaxFileSize=10MB&lt;/P&gt;
&lt;P class="p1"&gt;appender.file.MaxBackupIndex=10&lt;/P&gt;
&lt;P class="p1"&gt;appender.file.layout=org.apache.log4j.PatternLayout&lt;/P&gt;
&lt;P class="p1"&gt;appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;Ensure Correct Log4j2 Configuration:&lt;/STRONG&gt; Verify that the log4j2.properties file is being correctly referenced in your Spark configuration. The paths specified in spark.executor.extraJavaOptions and spark.driver.extraJavaOptions should point to the correct log4j2.properties file.&lt;/P&gt;
&lt;P class="p1"&gt;spark.executor.extraJavaOptions=-Dlog4j.configuration=file:///C:/spark-4.0.0-preview2-bin-hadoop3/conf/log4j2.properties&lt;/P&gt;
&lt;P class="p1"&gt;spark.driver.extraJavaOptions=-Dlog4j.configuration=&lt;A target="_blank"&gt;file:///C:/spark-4.0.0-preview2-bin-hadoop3/conf/log4j2.properties&lt;/A&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;Verify Directory Permissions:&lt;/STRONG&gt; Ensure that the directory C:/spark-4.0.0-preview2-bin-hadoop3/logs exists and that the user running the Spark application has write permissions to this directory&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2024 00:58:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-generate-log-files-on-specific-folders/m-p/102150#M40989</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2024-12-15T00:58:13Z</dc:date>
    </item>
  </channel>
</rss>

