Problem with logging to the stderr

Hi,

As we know, Orthanc sends its logs to stderr by default.

Imagine system where in a Microservices architecture you have a lot of services, and Orthanc is just one of them. There is central logging and monitoring system where admin can see logs from all services. Usually service sends logs as Information, Warning, Error etc. This central logging and monitoring system is critical because you can in a easy way monitor errors in the system.

Now, here is where problem begins with Orthanc. During debugging and testing of our system we want to run Orthanc in a --verbose mode. In this case situation is very difficult. A lot of logs comes from the Orthanc and all appear as a error even they are not just because Orthanc sends all logs to the stderr. Admin is not able to filter errors and properly monitor the system.

What can be done here in order to have more structured logs and that we can differentiate Information and Warnings from Errors in the Orthanc?

Thanks,
Vedran

Hello,

Since the first character of each Orthanc log line allows you to tell whether it’s an error entry, a warning, informational or trace, I suggest you use a log viewer that allows you to filter the loglines using a regular expression.

Another option is simply to use grep as follows. This example will filter out lines that start with an uppercase i : ^ means line start and [^I] means every character except I.

grep "^[^I]" orthanc.log

Hope this helps

It is very helpful. Thanks a lot!

Which are possible options for logs?

Error, Warning, Information, …

Something else?

Error
Warning
Information
Trace

hth