Question

Custom rules service logging

  • 27 February 2023
  • 4 replies
  • 48 views

We are creating custom logs in some of our rules services.

Currently, that is done using the StreamWriter class in a C# component, which can cause problems if multiple engines are trying to write to the same log file at the same time.

Anyone have any recommendations for a logging framework which we can use in a rules service?


4 replies

Userlevel 2
Badge +1

Hi Marc,

Streamwriter can indeed give issues as mentioned in https://stackoverflow.com/questions/19304209/streamwriter-multi-threading-c-sharp i’ve heard from Robert H.

 

There is an existing OTS syslog component for logging purposes, maybe this is something to consider as an example? The component is found on Github:

https://github.com/USoftRD/OffTheShelfs/tree/10.0/OTS_SYSLOG_CLIENT_RFC3164

The related article is:

 

Thanks, Dara, I will see if we can use this as a starting point.

I eventually ended up using Apache log4net, which seems to work well, and which obviously has many similarities with the log4j2 logging used by the Service Framework.

Userlevel 2
Badge +1

Ahh nice @marc  , good to know of,  looks indeed suitable to me!

Reply