View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0022929||Community||OCCT:Foundation Classes||public||2012-01-26 22:36||2017-07-13 16:20|
|Reporter||Roman Lygin||Assigned To||bugmaster|
|Target Version||7.2.0||Fixed in Version||6.8.0|
|Summary||0022929: [Coding Rules] Eliminate debug output|
|Description||OCC should not contaminate output with own debug info. This is especially important for library solutions that are based on OCC. This should become part of the Coding Rules and part of the code review process.|
OCC source code has numerous instances of debug output (e.g. using std::cerr or cout). Most often this is surrounded with #ifdef DEB (which is an OCC-specific macro instead of standard _DEBUG). Example STEPControl_ActorRead.cxx:
cout << "//What is?// NB COMPOUNDS: " << nbCompounds << endl;
Sometimes it is surrounded with specific macros which were probably supposed to be defined in debug mode only but got into release mode as well and always contaminate the output. Example StepFile_Read.cxx:
sout << " ... STEP File Read ... " << endl;
Thus, the output is contaminated both for the end-user app and for the libraries which are based on OCC. Normally the library should not output anything. Consider other options for debugging needs for own OCC developers.
Ideas for solutions:
0. Start with just enforcing this rule for any new modifications and prevent worsening the current situation.
1. Consider reuse of existing class(es) encapsulating debug output (e.g. similar to abstract CDM_MessageDriver and its subclasses; Message_* classes)
2. Design settings via API (e.g. trace level, destinations, etc) and environment variables.
3. Study other implementations (e.g. Qt's qDebug(), qWarning(),...)
4. Performance considerations. Avoid impact of this overhead infrastructure, e.g. by creating inlined no-ops in release mode.
|Steps To Reproduce||Examples:|
1. Launch Import/Export sample and see the log.
2. In DRAWEXE use stepread
|Tags||No tags attached.|
|Test case number||Not needed|
Supportive community feedback:
||Debug output should be suppressed now due to fixes for #25266 and 0025418. It still remains to elaborate consistent rules for this and add them to docs.|
Last edited: 2017-07-13 15:59
Problem is fixed by #0025266 and 0025418.
Could you please close it.
|2012-01-26 22:36||Roman Lygin||New Issue|
|2012-01-26 22:36||Roman Lygin||Assigned To||=> abv|
|2012-03-13 22:18||Roman Lygin||Note Added: 0019958|
|2014-10-28 04:23||abv||Relationship added||duplicate of 0025418|
|2014-10-28 04:23||abv||Target Version||=> 6.8.0|
|2014-10-28 04:26||abv||Relationship added||related to 0024091|
|2014-10-29 06:03||abv||Target Version||6.8.0 => 7.1.0|
|2014-10-29 06:06||abv||Note Added: 0033792|
|2016-11-03 17:07||abv||Target Version||7.1.0 => 7.2.0|
||Test case number||=> Not needed|
||Note Added: 0068264|
||Assigned To||abv => bugmaster|
||Status||new => feedback|
||Note Edited: 0068264|
|2017-07-13 16:20||bugmaster||Status||feedback => closed|
|2017-07-13 16:20||bugmaster||Resolution||open => fixed|
|2017-07-13 16:20||bugmaster||Fixed in Version||=> 6.8.0|