Does DCMTK support log4cplus::MDC?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Misi
Posts: 12
Joined: Wed, 2012-11-07, 09:31

Does DCMTK support log4cplus::MDC?

#1 Post by Misi »

Hi guys,

for some time log4cplus provides a class "MDC", which allows to set a so-called context for logging. Very helpful in my opinion. I wonder if the current DCMTK-release also provides this feature? I cannot find any reference...

Thanks,
MiSi

J. Riesmeier
DCMTK Developer
Posts: 2517
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Does DCMTK support log4cplus::MDC?

#2 Post by J. Riesmeier »

The short answer is: it depends, i.e. MDC is provided by the "oflog" module of the current DCMTK snapshot but not used by any of the other modules.

Could you please explain in more details why you think that "MDC" would be helpful? And of course, your contribution would be welcome :)

Btw, I found the following web page that tries to compare NDC with MDC...

Misi
Posts: 12
Joined: Wed, 2012-11-07, 09:31

Re: Does DCMTK support log4cplus::MDC?

#3 Post by Misi »

Thanks for the answer. MDC would be helpful in situation when you use multithreading.
For example, my application processes DICOM datasets in several threads at the same time and generates log outputs via OFLog. Then I could have difficulties to reproduce the processes because the log outputs become asynchronously.
It would be helpful if I could append a "context" to each log output, allowing to map the output to its appropriate thread/dataset. In this case, i.e. the SOPInstanceUID of the dataset. Of course one can append the UID mannually inside the output string, but using MDC is much more easier.

Hm... I wonder...I'm using DCMTK 3.6.1 (latest snapshot) but I cannot use log4cplus::MDC in my code since it's unknown to the compiler. I'm sure I have imported the OFlog library correctly. Are you sure MDC support comes with that DCMTK release?

J. Riesmeier
DCMTK Developer
Posts: 2517
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Does DCMTK support log4cplus::MDC?

#4 Post by J. Riesmeier »

Unfortunately, the latest snapshot package is almost one year old due to various staff changes here in Oldenburg (I personally created all DCMTK snapshots during the last years when I worked for the ICSMED company, but now someone from OFFIS should do this...)

Alternatively, you could (and should) download the latest development version via git. There's also a "download snapshot" function available on the git web interface, e.g. this one is from today: http://git.dcmtk.org/web?p=dcmtk.git;a= ... 0db;sf=tgz

Btw, support for MDC has been added on 2013-01-15 with this commit: http://git.dcmtk.org/web?p=dcmtk.git;a= ... 86052b9fc3

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest