dcmtk in a service

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
bibble_235
Posts: 12
Joined: Wed, 2010-03-17, 10:57

dcmtk in a service

#1 Post by bibble_235 »

Hi,

Had a binary I wanted to run in a windows service. This is cross platform and I use upstart to run it on Linux.

If I run it without the windows service wrapper as a plain .exe then the software works great. However if I wrap it in windows service wrappers, the ones they provide on the MDSDN, it fails over.

Tracked it down to consap.cc

log4cplus::tostream& output = (logToStdErr ? ofConsole.lockCerr() : ofConsole.lockCout());
output << "I will not crash"

Is there anyting I can do?

Uli Schlachter
DCMTK Developer
Posts: 120
Joined: Thu, 2009-11-26, 08:15

#2 Post by Uli Schlachter »

So as soon as DCMTK tries to use cout or cerr, it crashes? Windows services are weird...

You could use the --log-config option that a lot of the tools provide to make it use something else than the ConsoleAppender for logging (e.g. a FileAppender or a NullAppender).

If you are running your own code, calling Logger::getRoot().removeAllAppenders(); should get rid of the ConsoleAppender.

Hope this helps,
Uli

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest