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.

If anyone have ideas to change that category name or change the log4j configuration, please help.

Thanks in advance.

asked 29.08.2019 at 04:11

Lieu%20Vo's gravatar image

Lieu Vo
(suspended)
accept rate: 0%


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: https://developer.axonivy.com/doc/latest/EngineGuideHtml/monitoring.html#d5e3581

What you can do:

link

answered 29.08.2019 at 07:42

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

Thank you for your suggestion. But I have traced Ivy core, and I see: every time Ivy rest create a WebTarget instance, it registers a filter to trace log with specific category name "rest_client" in RestCallLoggingAndHistoryFilter 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, every request to every log file. How could I do that? I tried with log4j content filter by regular expression, but it is not working well. And I tried another solution: use java reflection for changing the runtimeLogger 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. Do you have any better solution for this requirement?

link

answered 29.08.2019 at 22:24

Lieu%20Vo's gravatar image

Lieu Vo
(suspended)
accept rate: 0%

edited 29.08.2019 at 22:28

ok let's try it the other way around. What is the goal you are trying to achieve? I mean having logs in separate files is a good idea. But what is the value you are trying to build?

(30.08.2019 at 07:44) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×147
×33
×9

Asked: 29.08.2019 at 04:11

Seen: 1,882 times

Last updated: 02.09.2019 at 08:43