<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Config ivy log in GCP</title><link>https://answers.axonivy.com/questions/4623/config-ivy-log-in-gcp</link><description>&lt;h2&gt;Dear ivy team support,&lt;/h2&gt;
&lt;p&gt;Currently, I'm doing some configuration for the ivy log in GCP environment. 
Here is my config:&lt;/p&gt;
&lt;hr&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"&amp;gt;
  &amp;lt;param name="Threshold" value="INFO"/&amp;gt;
  &amp;lt;param name="Target" value="System.out" /&amp;gt;
  &amp;lt;layout class="ch.ivyteam.log.layout.IvyLog4jLayout"&amp;gt;
      &amp;lt;param name="DateFormat" value="yyyy-MM-dd HH:mm:ss.SSS"/&amp;gt;
    &amp;lt;/layout&amp;gt;
  &amp;lt;filter class="org.apache.log4j.varia.LevelRangeFilter"&amp;gt;
    &amp;lt;param name="LevelMin" value="INFO"/&amp;gt;
    &amp;lt;param name="LevelMax" value="WARN"/&amp;gt;
    &amp;lt;param name="AcceptOnMatch" value="true"/&amp;gt;
  &amp;lt;/filter&amp;gt;
&amp;lt;/appender&amp;gt;

&amp;lt;!-- appender that writes log messages with priority ERROR or higher to stderr --&amp;gt;
&amp;lt;appender name="ConsoleAppenderError" class="org.apache.log4j.ConsoleAppender"&amp;gt;
  &amp;lt;param name="Threshold" value="ERROR"/&amp;gt;
  &amp;lt;param name="Target" value="System.err" /&amp;gt;
  &amp;lt;layout class="ch.ivyteam.log.layout.IvyLog4jLayout"&amp;gt;
      &amp;lt;param name="DateFormat" value="yyyy-MM-dd HH:mm:ss.SSS"/&amp;gt;
    &amp;lt;/layout&amp;gt;
&amp;lt;/appender&amp;gt;

  &amp;lt;!-- Disable CXF warning at startup (missing META-INF/cxf/cxf.xml) --&amp;gt;
  &amp;lt;category name="org.apache.cxf.bus.spring" class="ch.ivyteam.log.Logger"&amp;gt;
    &amp;lt;priority value="ERROR"/&amp;gt;
  &amp;lt;/category&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;But I got the problem:
With the exception, it will print each line of exception in the stackDriver log like this picture:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://serving.photos.photobox.com/28132375a8296995992fcbb28aeb802497fe58244761b0962f9f3903c8a51ecd38b4598a.jpg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;We use fluentd and Stackdriver to display the log. &lt;br&gt;
As I understood, we have 2 steps to display the log in the GCP &lt;br&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Step 1: Base on the configuration in the log4jconfig.xml, Ivy will print the log to the console with the corresponding format  so that fluentd can read it and display in the log view&lt;br&gt;&lt;/li&gt;
&lt;li&gt;Step 2: fluentd will read that log and display in the log view.&lt;br&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When I check step 2, it is correct because the fluentd displayed exactly the result of step 1. &lt;br&gt;
But step 1 got a problem, it prints incorrectly the entry log. I have 1 block exception but it prints to multiline log entries. &lt;br&gt;
My expectation: each exception case will be visualized by only 1 entry log so that developer can easier trace the exception reason and find the solution. &lt;br&gt;
Could you please give me some advice? &lt;br&gt;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/4623/config-ivy-log-in-gcp" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 13 Jul 2020 02:59:49 -0400</lastBuildDate><item><title>Answer by Alex Suter</title><link>https://answers.axonivy.com/questions/4623/config-ivy-log-in-gcp/4637</link><description>&lt;p&gt;I think this is a common problem of at least Java services. You can solve this problem with &lt;strong&gt;fluentd&lt;/strong&gt; itself&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/57327257/how-to-parse-multiline-java-error-exception-stack-traces-input-in-fluentd-i-sho"&gt;https://stackoverflow.com/questions/57327257/how-to-parse-multiline-java-error-exception-stack-traces-input-in-fluentd-i-sho&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/fluent/fluent-plugin-grok-parser/issues/69"&gt;https://github.com/fluent/fluent-plugin-grok-parser/issues/69&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It seems that in Log4j2 there is a configurable solution for this. It can also be done in log4j1 (current version in ivy) but it's not that easy to correctly implement it in ivy.
&lt;a href="https://stackoverflow.com/questions/38486248/how-to-make-log4j-syslog-appender-write-a-stack-trace-in-one-line/55407412#55407412"&gt;https://stackoverflow.com/questions/38486248/how-to-make-log4j-syslog-appender-write-a-stack-trace-in-one-line/55407412#55407412&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I recommend to solve it in &lt;strong&gt;fluentd&lt;/strong&gt; for now. On our side we plan to upgrade to &lt;strong&gt;log4j2&lt;/strong&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Mon, 13 Jul 2020 02:59:49 -0400</pubDate><guid>https://answers.axonivy.com/questions/4623/config-ivy-log-in-gcp/4637</guid></item></channel></rss>