<?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 Re: Show log4j messages in run output in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/100192#M40218</link>
    <description>&lt;P&gt;I got the information from support that this "feature" is currently not implemented.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":unamused_face:"&gt;😒&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Nov 2024 08:16:16 GMT</pubDate>
    <dc:creator>Dom1</dc:creator>
    <dc:date>2024-11-27T08:16:16Z</dc:date>
    <item>
      <title>Show log4j messages in run output</title>
      <link>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/66276#M33070</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;I have an issue when running JAR jobs. I expect to see logs in the output window of a run. Unfortunately, I can only see messages of that are generated with "System.out.println" or "System.err.println". Everything that is logged via slf4j is only shown in the log4j-Logs of the cluster.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dom1_0-1713189014582.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/7050i44157045E399C153/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Dom1_0-1713189014582.png" alt="Dom1_0-1713189014582.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Is there a way to show the logs of slf4j in the output window of the executed run? When we log in python then those logs are shown, so I hope that this is also possible for Java code.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks for your help&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Dominik&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 15 Apr 2024 13:50:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/66276#M33070</guid>
      <dc:creator>Dom1</dc:creator>
      <dc:date>2024-04-15T13:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Show log4j messages in run output</title>
      <link>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/66600#M33162</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your response. I just build a minimal project that looks like this:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;package logging;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestLogging {

	public static void main(String[] args) {
		log.trace("Test: Trace message");
		log.debug("Test: Debug message");
		log.info("Test: Info message");
		log.info("Test: New test with log4j2");
		log.warn("Test: Warning message");
		log.error("Test: Error message");
	}
}&lt;/LI-CODE&gt;&lt;P&gt;So just a simple main method that logs on different levels. My pom dependencies look like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;	&amp;lt;dependencies&amp;gt;

		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.apache.logging.log4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;log4j-api&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;2.23.1&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;

		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.apache.logging.log4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;log4j-core&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;2.23.1&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;

		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.apache.logging.log4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;log4j-slf4j2-impl&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;2.23.1&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;

		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.slf4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;slf4j-api&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;2.0.12&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;

		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.projectlombok&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;lombok&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;1.18.30&amp;lt;/version&amp;gt;
			&amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;
		&amp;lt;/dependency&amp;gt;
	&amp;lt;/dependencies&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;And here my log4j2.xml file&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;Configuration&amp;gt;
	&amp;lt;Appenders&amp;gt;

		&amp;lt;Console name="console" target="SYSTEM_OUT"&amp;gt;
			&amp;lt;PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" /&amp;gt;
		&amp;lt;/Console&amp;gt;

	&amp;lt;/Appenders&amp;gt;
	&amp;lt;Loggers&amp;gt;
		&amp;lt;Root level="INFO"&amp;gt;
			&amp;lt;AppenderRef ref="console" /&amp;gt;
		&amp;lt;/Root&amp;gt;
	&amp;lt;/Loggers&amp;gt;
&amp;lt;/Configuration&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;When I run this on my local machine, then it shows the following logs&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2024-04-18 14:33:00 [main] INFO  logging.TestLogging - Test: Info message
2024-04-18 14:33:00 [main] INFO  logging.TestLogging - Test: New test with log4j2
2024-04-18 14:33:00 [main] WARN  logging.TestLogging - Test: Warning message
2024-04-18 14:33:00 [main] ERROR logging.TestLogging - Test: Error message&lt;/LI-CODE&gt;&lt;P&gt;But when I package this as a jar, upload it to databricks and run the code then it does not print anything in the output window of the task. I see some logs in the Log4j output of the cluster but with a different logging pattern:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;24/04/18 12:24:10 INFO TestLogging: Test: Info message
24/04/18 12:24:10 INFO TestLogging: Test: New test with log4j2
24/04/18 12:24:10 WARN TestLogging: Test: Warning message
24/04/18 12:24:10 ERROR TestLogging: Test: Error message&lt;/LI-CODE&gt;&lt;P&gt;So I assume the logging settings of my jar is replaced somewhere. I don´t know how I can show the log messages into the output of the task run (or redirect them into one file for this specific run).&lt;/P&gt;&lt;P&gt;Hope the examples show what I am trying to accomplish&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 12:57:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/66600#M33162</guid>
      <dc:creator>Dom1</dc:creator>
      <dc:date>2024-04-18T12:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Show log4j messages in run output</title>
      <link>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/81867#M36435</link>
      <description>&lt;P&gt;Hi Fatma,&lt;/P&gt;&lt;P&gt;thanks a lot for your reply. Unfortunately, I have the same problem as Dom1. The standardout is visible in the output tab of each task, while logging messages are not displayed. I considered all of your solution hints, but the behaviour persists. My minimal example, adapted from above, looks like this. These are the dependencies in the pom.xml (I also tried with slf4j-simple as you suggested):&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;lt;dependencies&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;&amp;lt;!-- SLF4J API --&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;&amp;lt;dependency&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;groupId&amp;gt;&lt;/SPAN&gt;org.slf4j&lt;SPAN&gt;&amp;lt;/groupId&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;artifactId&amp;gt;&lt;/SPAN&gt;slf4j-api&lt;SPAN&gt;&amp;lt;/artifactId&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;version&amp;gt;&lt;/SPAN&gt;1.7.30&lt;SPAN&gt;&amp;lt;/version&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    &amp;lt;/dependency&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;&amp;lt;!-- Logback Classic (includes SLF4J binding) --&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;&amp;lt;dependency&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;groupId&amp;gt;&lt;/SPAN&gt;ch.qos.logback&lt;SPAN&gt;&amp;lt;/groupId&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;artifactId&amp;gt;&lt;/SPAN&gt;logback-classic&lt;SPAN&gt;&amp;lt;/artifactId&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;version&amp;gt;&lt;/SPAN&gt;1.2.3&lt;SPAN&gt;&amp;lt;/version&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    &amp;lt;/dependency&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/dependencies&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;And this is the code contained in the jar:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.slf4j.Logger;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.slf4j.LoggerFactory;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public class &lt;/SPAN&gt;TestLogging {&lt;BR /&gt;    &lt;SPAN&gt;private static final &lt;/SPAN&gt;Logger &lt;SPAN&gt;logger &lt;/SPAN&gt;= LoggerFactory.&lt;SPAN&gt;getLogger&lt;/SPAN&gt;(TestLogging.&lt;SPAN&gt;class&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;public static void &lt;/SPAN&gt;&lt;SPAN&gt;main&lt;/SPAN&gt;(String[] args) {&lt;BR /&gt;        &lt;SPAN&gt;logger&lt;/SPAN&gt;.info(&lt;SPAN&gt;"This is an INFO message."&lt;/SPAN&gt;);&lt;BR /&gt;        &lt;SPAN&gt;logger&lt;/SPAN&gt;.warn(&lt;SPAN&gt;"This is a WARN message."&lt;/SPAN&gt;);&lt;BR /&gt;        &lt;SPAN&gt;logger&lt;/SPAN&gt;.error(&lt;SPAN&gt;"This is an ERROR message."&lt;/SPAN&gt;);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Is it possible that it is an issue with log4j 2? I have version 2.20 installed. Help would be much appreciated as the missing logs make debugging very cumbersome.&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 11:10:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/81867#M36435</guid>
      <dc:creator>Wolvi</dc:creator>
      <dc:date>2024-08-05T11:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Show log4j messages in run output</title>
      <link>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/82206#M36555</link>
      <description>&lt;P&gt;Follow-Up: It seems that the wrong libraries are installed in the background. When i upload my jar and start the task other versions are displayed, i.e., locally I pack the following versions into my jar:&lt;/P&gt;&lt;P&gt;Log4j API version: 2.23.1&lt;BR /&gt;Log4j Core version: 2.23.1&lt;BR /&gt;SLF4J API version: 2.0.7&lt;BR /&gt;SLF4J to Log4j Binding version: 2.20.0&lt;BR /&gt;SLF4J Simple version: 2.0.0&lt;/P&gt;&lt;P&gt;However, when i run the task, the following is shown:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;NoClassDefFoundError: org/slf4j/simple/SimpleLogger Caused by: ClassNotFoundException: org.slf4j.simple.SimpleLogger&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;at TestLogging.main(TestLogging.java:22)&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Log4j API version: 2.20.0&lt;/DIV&gt;&lt;DIV class=""&gt;Log4j Core version: 2.20.0&lt;/DIV&gt;&lt;DIV class=""&gt;SLF4J API version: 2.0.7&lt;/DIV&gt;&lt;DIV class=""&gt;SLF4J to Log4j Binding version: 1.7.25&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;It seems that in the background other libraries are loaded, which could be a problem as Slf4j to log4j has a version potentially not compatible with the other libraries.&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Aug 2024 12:37:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/82206#M36555</guid>
      <dc:creator>Wolvi</dc:creator>
      <dc:date>2024-08-07T12:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Show log4j messages in run output</title>
      <link>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/99809#M40105</link>
      <description>&lt;P&gt;Any update on this? I am also facing this issue.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 19:06:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/99809#M40105</guid>
      <dc:creator>dbal</dc:creator>
      <dc:date>2024-11-22T19:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Show log4j messages in run output</title>
      <link>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/100192#M40218</link>
      <description>&lt;P&gt;I got the information from support that this "feature" is currently not implemented.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":unamused_face:"&gt;😒&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 08:16:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/show-log4j-messages-in-run-output/m-p/100192#M40218</guid>
      <dc:creator>Dom1</dc:creator>
      <dc:date>2024-11-27T08:16:16Z</dc:date>
    </item>
  </channel>
</rss>

