For the new oflog classes, there are some rules which should be considered when writing command line applications.
The following steps should be done, if possible:
OFCommandLine::addOption() and the like. If console output is needed here, COUT and CERR should be used.OFLog::addOptions(cmd) where cmd is an OFCommandLine object. Please use the correct position!OFConsoleApplication::parseCommandLine() and set program variables depending on command line options, OFCommandLine::findOption() and the like. If logging is needed here, app.printError() can be used, or COUT for normal messages. For conflicts and dependencies of options, use OFConsoleApplication::checkConflict() and OFConsoleApplication::checkDependence().OFLog::configureFromCommandLine(cmd, app) where cmd is an OFCommandLine and app is an OFConsoleApplication object.storescp this is OFLOG_DEBUG(storescpLogger, rcsid « OFendl);.COUT/CERR/printf or anything should not be used any more but everything should go to the loggers instead.
Please note that all DCMTK commandline tools call prepareCmdLineArgs() in the main() function which causes stderr to be mapped to stdout on Windows systems (since previous versions of the Windows operating system could not redirect stderr).
Discussion