<?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: Why isn't the Splunk logger appender terminating? Our Java program keeps running with no exit code. in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355903#M5711</link>
    <description>&lt;P&gt;I'm not sure if I understand why the Splunk logging libraries don't exit. My work has been completed -- how is it supposed to shut down gracefully?&lt;/P&gt;</description>
    <pubDate>Thu, 03 May 2018 14:44:14 GMT</pubDate>
    <dc:creator>althomas</dc:creator>
    <dc:date>2018-05-03T14:44:14Z</dc:date>
    <item>
      <title>Why isn't the Splunk logger appender terminating? Our Java program keeps running with no exit code.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355900#M5708</link>
      <description>&lt;P&gt;We followed the steps in below documentation for "Enable logging to HTTP Event Collector in your Java project". &lt;BR /&gt;&lt;A href="http://dev.splunk.com/view/splunk-logging-java/SP-CAAAE7M" target="_blank"&gt;http://dev.splunk.com/view/splunk-logging-java/SP-CAAAE7M&lt;/A&gt; &lt;BR /&gt;In our testing, we are seeing that Splunk logger appender is not terminating. Our java program keeps running with no exit code.&lt;/P&gt;
&lt;P&gt;Steps to reproduce:&lt;BR /&gt;- Import attached code to IntelliJ IDE &lt;BR /&gt;- Change http collect token and url in logback.xml &lt;BR /&gt;- Run the main java&lt;/P&gt;
&lt;P&gt;Unfortunately, I cannot attach files here due to fewer karma points.&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;here are the files:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;test.java&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.splunk.logging.*;

public class test {
    public static void main( String[] args ) {
        System.out.println("This is first");

        Logger logger = LoggerFactory.getLogger("splunk");
        logger.info("This is a test event for Logback test");
        logger.error("This is a test error for Logback test");
        System.out.println("This is second");


    }
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;STRONG&gt;logback.xml&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;configuration&amp;gt;
    &amp;lt;Appender name="http" class="com.splunk.logging.HttpEventCollectorLogbackAppender"&amp;gt;
        &amp;lt;url&amp;gt;http://splunkheavyforwarder.dev.aws.away.black:8088&amp;lt;/url&amp;gt;
        &amp;lt;token&amp;gt;640D5ED1-4D44-484A-8576-F8BA16746954&amp;lt;/token&amp;gt;
        &amp;lt;disableCertificateValidation&amp;gt;true&amp;lt;/disableCertificateValidation&amp;gt;
        &amp;lt;layout class="ch.qos.logback.classic.PatternLayout"&amp;gt;
            &amp;lt;Pattern&amp;gt;
                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
            &amp;lt;/Pattern&amp;gt;
        &amp;lt;/layout&amp;gt;
    &amp;lt;/Appender&amp;gt;

    &amp;lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&amp;gt;
        &amp;lt;layout class="ch.qos.logback.classic.PatternLayout"&amp;gt;
            &amp;lt;Pattern&amp;gt;
                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
            &amp;lt;/Pattern&amp;gt;
        &amp;lt;/layout&amp;gt;
    &amp;lt;/appender&amp;gt;
    &amp;lt;logger name ="http" level="debug"&amp;gt;
        &amp;lt;appender-ref ref="http" /&amp;gt;
    &amp;lt;/logger&amp;gt;
    &amp;lt;root level="INFO"&amp;gt;
        &amp;lt;appender-ref ref="http"/&amp;gt;
    &amp;lt;/root&amp;gt;
&amp;lt;/configuration&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Let me know in case you need additional information.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2020 18:42:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355900#M5708</guid>
      <dc:creator>SNaikwade</dc:creator>
      <dc:date>2020-06-07T18:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't the Splunk logger appender terminating? Our Java program keeps running with no exit code.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355901#M5709</link>
      <description>&lt;P&gt;I found the answer.&lt;/P&gt;

&lt;P&gt;The non-exiting nature of Splunk logging libraries is intentional. So it is expected behavior.&lt;BR /&gt;
So the workaround is to create a custom middleware class like &lt;CODE&gt;HttpEventCollectorResendMiddleware.java&lt;/CODE&gt;, in which your &lt;CODE&gt;completed()&lt;/CODE&gt; method can check that &lt;CODE&gt;statusCode==200&lt;/CODE&gt; once all events have been sent. This way you can safely exit your application.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2017 14:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355901#M5709</guid>
      <dc:creator>SNaikwade</dc:creator>
      <dc:date>2017-10-02T14:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't the Splunk logger appender terminating? Our Java program keeps running with no exit code.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355902#M5710</link>
      <description>&lt;P&gt;How do you check if all events have been sent? Can you please add you code for HttpEventCollectorResendMiddleware? &lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 00:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355902#M5710</guid>
      <dc:creator>arash_jalalian</dc:creator>
      <dc:date>2017-10-04T00:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't the Splunk logger appender terminating? Our Java program keeps running with no exit code.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355903#M5711</link>
      <description>&lt;P&gt;I'm not sure if I understand why the Splunk logging libraries don't exit. My work has been completed -- how is it supposed to shut down gracefully?&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 14:44:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355903#M5711</guid>
      <dc:creator>althomas</dc:creator>
      <dc:date>2018-05-03T14:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't the Splunk logger appender terminating? Our Java program keeps running with no exit code.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355904#M5712</link>
      <description>&lt;P&gt;This is a known bug, which affects &lt;EM&gt;all&lt;/EM&gt; of the mechanisms implemented by the splunk-library-javalogging, not just logback. &lt;A href="https://github.com/splunk/splunk-library-javalogging/issues/115"&gt;Here&lt;/A&gt;, for example, is the Github issue for a log4j2 part. Fixes, such as &lt;A href="https://github.com/splunk/splunk-library-javalogging/pull/122/files"&gt;this one&lt;/A&gt; are offered for the &lt;CODE&gt;HttpEventCollectorResendMiddleware.java&lt;/CODE&gt;, which would fix all logging methods at once too.&lt;/P&gt;

&lt;P&gt;No idea, why this still is not in the released JAR &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 03:47:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-isn-t-the-Splunk-logger-appender-terminating-Our-Java/m-p/355904#M5712</guid>
      <dc:creator>unitedmarsupial</dc:creator>
      <dc:date>2019-12-04T03:47:29Z</dc:date>
    </item>
  </channel>
</rss>

