<?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: Java Logging Appenders: Error after sending logs from log4j-slf4j-impl directly to Splunk in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Java-Logging-Appenders-Error-after-sending-logs-from-log4j-slf4j/m-p/426484#M52145</link>
    <description>&lt;P&gt;Thank you for your assistance.&lt;BR /&gt;
The problem was that i used the cloud, When i installed a normal Splunk instance the problem diapered. &lt;BR /&gt;
Thank you again&lt;BR /&gt;
John&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2019 14:03:11 GMT</pubDate>
    <dc:creator>johnjonatan319</dc:creator>
    <dc:date>2019-06-20T14:03:11Z</dc:date>
    <item>
      <title>Java Logging Appenders: Error after sending logs from log4j-slf4j-impl directly to Splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Java-Logging-Appenders-Error-after-sending-logs-from-log4j-slf4j/m-p/426482#M52143</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to send logs from demo app that I built using the log4j-slf4j-impl library to Splunk Cloud instance.&lt;BR /&gt;
I followed the instruction in &lt;A href="http://dev.splunk.com/view/splunk-logging-java/SP-CAAAE7M"&gt;http://dev.splunk.com/view/splunk-logging-java/SP-CAAAE7M&lt;/A&gt;&lt;BR /&gt;
My code contains a Main class, log4j2.xml, and a pom file.&lt;/P&gt;

&lt;P&gt;Main class:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
import com.splunk.logging.HttpEventCollectorLog4jAppender;

 public class TestApp {
     public static final Logger LOG = LogManager.getLogger("testApp");
     public static void main(String[] args) {
         LOG.info("This Will Be Printed On Info");
         LOG.error("This Will Be Printed On Error");
         LOG.fatal("This Will Be Printed On Fatal");
     }
 }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;log4j2.xml is located in path: \src\main\resources\log4j2.xml&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
 &amp;lt;Configuration xmlns="http://logging.apache.org/log4j/2.0/config"&amp;gt;
     &amp;lt;Appenders&amp;gt;
         &amp;lt;Console name="STDOUT" target="SYSTEM_OUT"&amp;gt;
             &amp;lt;PatternLayout pattern="%-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2} (%F:%L) - %m%n" /&amp;gt;
         &amp;lt;/Console&amp;gt;
         &amp;lt;Http name="http" url="https://%URL%.cloud.splunk.com/services/collector" token="%TOKEN%" disableCertificateValidation="true"&amp;gt;
             &amp;lt;PatternLayout pattern="%-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2} (%F:%L) - %m%n" /&amp;gt;
         &amp;lt;/Http&amp;gt;
     &amp;lt;/Appenders&amp;gt;
     &amp;lt;Loggers&amp;gt;
         &amp;lt;Logger name="testApp" level="debug" /&amp;gt;
         &amp;lt;Root level="info"&amp;gt;
             &amp;lt;AppenderRef ref="STDOUT" /&amp;gt;
             &amp;lt;AppenderRef ref="http"/&amp;gt;
         &amp;lt;/Root&amp;gt;
     &amp;lt;/Loggers&amp;gt;
 &amp;lt;/Configuration&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;pom.xml:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 &lt;A href="http://maven.apache.org/xsd/maven-4.0.0.xsd&amp;quot;&amp;gt;" target="test_blank"&gt;http://maven.apache.org/xsd/maven-4.0.0.xsd"&amp;gt;&lt;/A&gt;;
    &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;
    &amp;lt;groupId&amp;gt;log4j-slf4j-impl-example&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;log4j-slf4j-impl-example&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0-SNAPSHOT&amp;lt;/version&amp;gt;
    &amp;lt;repositories&amp;gt;
        &amp;lt;repository&amp;gt;
            &amp;lt;id&amp;gt;splunk-artifactory&amp;lt;/id&amp;gt;
            &amp;lt;name&amp;gt;Splunk Releases&amp;lt;/name&amp;gt;
            &amp;lt;url&amp;gt;http://splunk.jfrog.io/splunk/ext-releases-local&amp;lt;/url&amp;gt;
        &amp;lt;/repository&amp;gt;
    &amp;lt;/repositories&amp;gt;
    &amp;lt;dependencies&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;com.splunk.logging&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;splunk-library-javalogging&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;1.7.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-slf4j-impl&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;2.3.0&amp;lt;/version&amp;gt;
        &amp;lt;/dependency&amp;gt;
    &amp;lt;/dependencies&amp;gt;
&amp;lt;/project&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result of the app is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   INFO  | 2019-06-14 15:39:46 | [main] TestApp (TestApp.java:9) - This Will Be Printed On Info
     ERROR | 2019-06-14 15:39:46 | [main] TestApp (TestApp.java:10) - This Will Be Printed On Error
     FATAL | 2019-06-14 15:39:46 | [main] TestApp (TestApp.java:11) - This Will Be Printed On Fatal
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which means that the app runs, and prints to console as in the appender, But the program continues to run, &lt;BR /&gt;
in my opinion, it can't reach the URL address of my Splunk instance. I also checked my Splunk instance and no data reached the server. &lt;BR /&gt;
Can any guide me on what is not configured correctly?&lt;/P&gt;

&lt;P&gt;Thank you in advance&lt;BR /&gt;
John&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 11:10:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Java-Logging-Appenders-Error-after-sending-logs-from-log4j-slf4j/m-p/426482#M52143</guid>
      <dc:creator>johnjonatan319</dc:creator>
      <dc:date>2019-06-15T11:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Java Logging Appenders: Error after sending logs from log4j-slf4j-impl directly to Splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Java-Logging-Appenders-Error-after-sending-logs-from-log4j-slf4j/m-p/426483#M52144</link>
      <description>&lt;P&gt;Hi @johnjonatan319 ,&lt;/P&gt;

&lt;P&gt;Here are things to check for troubleshooting:&lt;BR /&gt;
- Do you receive events from that host for the _internal index?&lt;BR /&gt;
If not, then you probably do not have the forward setup to send data to SplunkCloud correctly: &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/7.2.6/User/DataSplunkCloudcanindex"&gt;https://docs.splunk.com/Documentation/SplunkCloud/7.2.6/User/DataSplunkCloudcanindex&lt;/A&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Instead of writing to STDOUT, write to a file on disk, and then configure the forwarder to watch that file
If this works, then it would be an issue with the way the app is processing STDOUT information.  Maybe writing to disk would be a better option for troubleshooting and providing the ability to re-ingest missed events in the case of a network issue/error.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Let me know if this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 16:54:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Java-Logging-Appenders-Error-after-sending-logs-from-log4j-slf4j/m-p/426483#M52144</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-18T16:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Java Logging Appenders: Error after sending logs from log4j-slf4j-impl directly to Splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Java-Logging-Appenders-Error-after-sending-logs-from-log4j-slf4j/m-p/426484#M52145</link>
      <description>&lt;P&gt;Thank you for your assistance.&lt;BR /&gt;
The problem was that i used the cloud, When i installed a normal Splunk instance the problem diapered. &lt;BR /&gt;
Thank you again&lt;BR /&gt;
John&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 14:03:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Java-Logging-Appenders-Error-after-sending-logs-from-log4j-slf4j/m-p/426484#M52145</guid>
      <dc:creator>johnjonatan319</dc:creator>
      <dc:date>2019-06-20T14:03:11Z</dc:date>
    </item>
  </channel>
</rss>

