<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to change the category name of the log when calling REST client by using Ivy.rest().client(...) ?</title><link>https://answers.axonivy.com/questions/3944/how-to-change-the-category-name-of-the-log-when-calling-rest-client-by-using-ivy-rest-client</link><description>&lt;p&gt;When I call any REST clients by using Ivy.rest().client(...), it will have the log with the category name [rest_client] from IVY Core. However, I want to make the log messages written into the specific log files of each services. With the same category name for all REST services like this, I could not find any way to configure in log4jconfig.xml to make it correct.&lt;/p&gt;
&lt;p&gt;If anyone have ideas to change that category name or change the log4j configuration, please help.&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/3944/how-to-change-the-category-name-of-the-log-when-calling-rest-client-by-using-ivy-rest-client" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 29 Aug 2019 22:24:52 -0400</lastBuildDate><item><title>Answer by Lieu Vo</title><link>https://answers.axonivy.com/questions/3944/how-to-change-the-category-name-of-the-log-when-calling-rest-client-by-using-ivy-rest-client/3953</link><description>&lt;p&gt;Thank you for your suggestion.
But I have traced Ivy core, and I see: every time Ivy rest create a &lt;strong&gt;WebTarget&lt;/strong&gt; instance, it registers a filter to trace log with specific category name &lt;strong&gt;"rest_client"&lt;/strong&gt; in &lt;strong&gt;RestCallLoggingAndHistoryFilter&lt;/strong&gt; class. It traces all rest request with same one category.
With your suggestion, I only could forward log of all requests to one log file.
So, my requirement needs to separate the log content for every request, &lt;strong&gt;every request to every log file.&lt;/strong&gt; &lt;strong&gt;How could I do that?&lt;/strong&gt;
I tried with log4j content filter by regular expression, but it is not working well.
And I tried another solution: use &lt;strong&gt;java reflection&lt;/strong&gt; for changing the &lt;strong&gt;runtimeLogger&lt;/strong&gt; property in that filter to separate them to every log file for every request. But I think this solution not good if the variable has been changed the name in the future or this way will make performance slower a little bit.
&lt;strong&gt;Do you have any better solution for this requirement?&lt;/strong&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lieu Vo</dc:creator><pubDate>Thu, 29 Aug 2019 22:24:52 -0400</pubDate><guid>https://answers.axonivy.com/questions/3944/how-to-change-the-category-name-of-the-log-when-calling-rest-client-by-using-ivy-rest-client/3953</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/3944/how-to-change-the-category-name-of-the-log-when-calling-rest-client-by-using-ivy-rest-client/3950</link><description>&lt;p&gt;I do not see an easy solution for this. As the service name is not part of the logger name. Otherwise you could easily route them into files as shown here: &lt;a href="https://developer.axonivy.com/doc/latest/EngineGuideHtml/monitoring.html#d5e3581"&gt;https://developer.axonivy.com/doc/latest/EngineGuideHtml/monitoring.html#d5e3581&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What you can do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use jerseys rest logging feature: and configure or customize it for your needs &amp;gt; &lt;code&gt;org.glassfish.jersey.logging.LoggingFeature&lt;/code&gt;. Then you have to add it to all rest client configurations that are of interest.&lt;/li&gt;
&lt;li&gt;use the ElkStack: to persist logs in elasticSearch and analyse it with tool done for the job. &lt;a href="https://jira.axonivy.com/confluence/display/AIGUIDE01/How+to+analyze+logs+with+the+ELK+stack"&gt;https://jira.axonivy.com/confluence/display/AIGUIDE01/How+to+analyze+logs+with+the+ELK+stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 29 Aug 2019 07:42:40 -0400</pubDate><guid>https://answers.axonivy.com/questions/3944/how-to-change-the-category-name-of-the-log-when-calling-rest-client-by-using-ivy-rest-client/3950</guid></item></channel></rss>