MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0022929Community[OCCT] OCCT:Foundation Classespublic2012-01-26 22:362017-07-13 16:20
ReporterRoman Lygin 
Assigned Tobugmaster 
PrioritynormalSeverityfeature 
StatusclosedResolutionfixed 
PlatformAOSLOS VersionL
Product Version[OCCT] 6.5.2 
Target Version[OCCT] 7.2.0Fixed in Version[OCCT] 6.8.0 
Summary0022929: [Coding Rules] Eliminate debug output
DescriptionOCC 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.

Details:
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:
#ifdef DEB
cout << "//What is?// NB COMPOUNDS: " << nbCompounds << endl;
...
#endif

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:
#define CHRONOMESURE
...
#ifdef CHRONOMESURE
  sout << " ... STEP File Read ... " << endl;
  c.Show();
#endif

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 ReproduceExamples:
1. Launch Import/Export sample and see the log.
2. In DRAWEXE use stepread
TagsNo tags attached.
Test case numberNot needed
Attached Files

- Relationships
duplicate of 0025418closedbugmaster Community Debug output to be limited to OCC development environment 
related to 0024091closedabv Open CASCADE DEB usage in public headers 

-  Notes
(0019958)
Roman Lygin (developer)
2012-03-13 22:18

Supportive community feedback:
http://www.opencascade.org/org/forum/thread_22961/ [^]
(0033792)
abv (manager)
2014-10-29 06:06

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.
(0068264)
mkv (tester)
2017-07-13 15:59
edited on: 2017-07-13 15:59

Dear BugMaster,
Problem is fixed by #0025266 and 0025418.
Could you please close it.


- Issue History
Date Modified Username Field Change
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
2017-07-13 15:57 mkv Test case number => Not needed
2017-07-13 15:59 mkv Note Added: 0068264
2017-07-13 15:59 mkv Assigned To abv => bugmaster
2017-07-13 15:59 mkv Status new => feedback
2017-07-13 15:59 mkv Note Edited: 0068264 View Revisions
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


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker