MantisBT - Community
View Issue Details
0025418Community[OCCT] OCCT:Releasepublic2014-10-24 00:042020-12-02 12:26
Roman Lygin 
bugmaster 
normalintegration request 
closedfixed 
[OCCT] 6.8.0 
[OCCT] 6.8.0[OCCT] 6.8.0 
Not needed
0025418: Debug output to be limited to OCC development environment
Open CASCADE has multiple debug prints which are output in customer applications/libraries in debug mode, although this is essentially internal Open CASCADE stuff.

The fix contains modifications of a few occurrences which often appear in modeling, Shape Healing, OCAF, data exchange scenarios. The fix just adds an extra compilation condition - a macro OCCT_DEVELOPMENT which can be specified in OCC development environment. The name is chosen after 0023943.

This is certainly a partial step in addressing the issue but definitively helps to suppress OCC messages which contaminate the user-specific logs and can be annoying for downstream users.

N/A
No tags attached.
parent of 0031970assigned dpasukhi Open CASCADE Data Exchange, STEP reader - parser syntax error messages are inaccessible 
has duplicate 0022929closed bugmaster Community [Coding Rules] Eliminate debug output 
related to 0024091closed abv Open CASCADE DEB usage in public headers 
Not all the children of this issue are yet resolved or closed.
Issue History
2014-10-24 00:04Roman LyginNew Issue
2014-10-24 00:04Roman LyginAssigned To => abv
2014-10-24 00:09gitNote Added: 0033663
2014-10-24 00:09Roman LyginNote Added: 0033664
2014-10-24 00:09Roman LyginAssigned Toabv => bugmaster
2014-10-24 00:09Roman LyginStatusnew => resolved
2014-10-24 08:34kgvRelationship addedrelated to 0025266
2014-10-24 08:36kgvNote Added: 0033665
2014-10-24 08:36kgvAssigned Tobugmaster => Roman Lygin
2014-10-24 08:36kgvStatusresolved => assigned
2014-10-24 09:30Roman LyginNote Added: 0033668
2014-10-24 10:04gitNote Added: 0033672
2014-10-24 10:06Roman LyginNote Added: 0033673
2014-10-24 10:06Roman LyginAssigned ToRoman Lygin => bugmaster
2014-10-24 10:06Roman LyginStatusassigned => resolved
2014-10-24 10:24kgvNote Added: 0033675
2014-10-24 12:06Roman LyginNote Added: 0033676
2014-10-24 12:15kgvNote Added: 0033677
2014-10-24 12:17kgvNote Edited: 0033677bug_revision_view_page.php?bugnote_id=33677#r8480
2014-10-24 12:33jgvNote Added: 0033679
2014-10-28 04:23abvRelationship addedhas duplicate 0022929
2014-10-28 08:20kgvAssigned Tobugmaster => abv
2014-10-28 17:09gitNote Added: 0033779
2014-10-28 17:12abvNote Added: 0033780
2014-10-28 17:12abvAssigned Toabv => jgv
2014-10-29 14:50jgvNote Added: 0033828
2014-10-29 14:50jgvAssigned Tojgv => bugmaster
2014-10-29 14:50jgvStatusresolved => reviewed
2014-10-29 16:36apvAssigned Tobugmaster => apv
2014-10-31 17:17apvTest case number => Not needed
2014-11-05 11:45apvNote Added: 0034023
2014-11-05 11:45apvAssigned Toapv => bugmaster
2014-11-05 11:45apvStatusreviewed => tested
2014-11-05 12:49gitNote Added: 0034033
2014-11-06 15:18bugmasterChangeset attached => occt master 0797d9d3
2014-11-06 15:18bugmasterStatustested => verified
2014-11-06 15:18bugmasterResolutionopen => fixed
2014-11-11 12:42aivFixed in Version => 6.8.0
2014-11-11 13:03aivStatusverified => closed
2014-11-12 09:54gitNote Added: 0034341
2014-11-12 09:54gitNote Added: 0034342
2014-11-12 09:55gitNote Added: 0034343
2014-11-12 09:55gitNote Added: 0034344
2015-09-09 11:50abvRelationship addedrelated to 0024091
2020-12-02 12:26kgvRelationship addedparent of 0031970

Notes
(0033663)
git   
2014-10-24 00:09   
Branch CR25418 has been created by Roman Lygin.

SHA-1: c2a717fddbb88b7680181126b955779272a35fe3


Detailed log of new commits:

Author: Roman Lygin
Date: Fri Oct 24 00:08:40 2014 +0400

    0025418: Debug output to be limited to OCC development environment

Author: Roman Lygin
Date: Tue Oct 14 08:28:22 2014 +0400

    initial commit
(0033664)
Roman Lygin   
2014-10-24 00:09   
The fix has been pushed to the repository
(0033665)
kgv   
2014-10-24 08:36   
Dear Roman,

your patch conflicts with issue #0025266 integrated to master a week ago.
(0033668)
Roman Lygin   
2014-10-24 09:30   
Thanks Kirill! What a clash indeed!
I started working on this on the base of 6.8.0 beta and did not rebase before pushing :-(.
Having a single macro (like OCCT_DEVELOPMENT) could be a more efficient way for your development process but this is totally up to you.
At this moment I cannot rebase to current master due to the CRLF conflict issue of a few OCC files (reported to bugmaster and Andrey). Anyway, most likely the branch will be deleted and the tracker will be closed as duplicate. Please stay tuned
(0033672)
git   
2014-10-24 10:04   
Branch CR25418_2 has been created by Roman Lygin.

SHA-1: dde1a635639e7b7908ee193a18d8ac4e568b4c0d


Detailed log of new commits:

Author: Roman Lygin
Date: Fri Oct 24 10:03:26 2014 +0400

    initial commit
    0025418: Debug output to be limited to OCC development environment
(0033673)
Roman Lygin   
2014-10-24 10:06   
Rabased after applying hints from Andrey and pushed as the CR25418_2 branch. Only 5 files survived, the rest were dropped in favor of #25266.
(0033675)
kgv   
2014-10-24 10:24   
+#if defined(DEB) && defined(OCCT_DEVELOPMENT)
   AddPrinter ( new Message_PrinterOStream );
+#endif

What is the point to block every output by default?
Messenger is the proper way to print messages in OCCT, including debug ones (Trace level).
Application should configure printers of default messenger at the very beginning. And there is a straightforward way to remove already assigned ones (e.g. by type, if you don't like Message_PrinterOStream for some reason).

+#if defined(DEB) && defined(OCCT_DEVELOPMENT)  
     sout << " ...  Exception Raised while reading Step File : " << ficnom << 
":\n" << endl;
     sout << Standard_Failure::Caught()->GetMessageString();  
     sout << "    ..." << endl;
+#endif

I'm not familiar with StepFile package, but why the reason of the failure should be buried deep inside the algorithm?
(0033676)
Roman Lygin   
2014-10-24 12:06   
Regarding the Message package:
I believe it should be the opt-in policy, not the opt-out. That is, if you want to subscribe to the messages do this explicitly by Message::DefaultMessenger()->AddPrinter ( new Message_PrinterOStream );
This way it will be consistent with other usages, e.g. in OCAF message drivers and apparently any other output (which is being suppressed by this very fix and #25266).
The OCC developers will not be affected by this change if OCCT_DEVELOPMENT macro is enabled in the development process.

Regarding the StepFile package, frankly, I am not getting your comment, sorry :-\. Anyway the change is just consistent with others, not changing the existing business logic.
(0033677)
kgv   
2014-10-24 12:15   
(edited on: 2014-10-24 12:17)
> Regarding the StepFile package, frankly, I am not getting your comment, sorry :-\.
> Anyway the change is just consistent with others, not changing the existing business logic.
The difference is that one messages have been previously passed directly to std::cout, and in most cases - clearly for debugging purposes.
While quoted statement have used Messenger interface, and thus have been available to user in GUI application as well.

At the same time Messenger provides priorities which allows to suppress low-priority messages at run-time, not requiring to re-compile OCCT.
Not-only-for-debug messages are better to keep available (with lower priority if make sense), if them do not noticeably affect performance.

> The OCC developers will not be affected by this change
> if OCCT_DEVELOPMENT macro is enabled in the development process.
The strategy of unified macros does not make sense because visualization developer does not care much about bloating messages from OCAF component and vice versa.

Purely debugging outputs should be either removed or escaped by component-specific macros, if them really useful for this particular component maintainer.

(0033679)
jgv   
2014-10-24 12:33   
I agree with Roman that having a single macro (like OCCT_DEVELOPMENT) that enables ALL debug messages is strictly necessary for developers.
(0033779)
git   
2014-10-28 17:09   
Branch CR25418_3 has been created by abv.

SHA-1: 1eff37863447b63de5b28cca9eae5b2f6139e23d


Detailed log of new commits:

Author: abv
Date: Tue Oct 28 12:41:04 2014 +0300

    0025418: Debug output to be limited to OCC development environment
    
    Macros ending on "DEB" are replaced by OCCT_DEBUG across OCCT code; new macros described in documentation.
    Macros starting with DEB are changed to start with "OCCT_DEBUG_".
    Some code cleaned.
(0033780)
abv   
2014-10-28 17:12   
I have pushed revised change to branch CR25418_3, please review. In general it follows Roman's idea, the macro that enables extra debug message is called OCCT_DEBUG; on Windows it can be enabled by setting CSF_DEFINES=OCCT_DEBUG in custom.bat. Message_Messenger is kept as before, outputting to cout by default.
(0033828)
jgv   
2014-10-29 14:50   
Ok.
(0034023)
apv   
2014-11-05 11:45   
Dear BugMaster,

Branch CR25418_3 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 1eff37863447b63de5b28cca9eae5b2f6139e23d

Number of compiler warnings:
occt component:
   Linux: 18 (18 on master)
   Windows: 0 (0 on master)
products component:
   Linux: 11 (11 on master)
   Windows: 1 (1 on master)

Regressions/Differences:
Not detected

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 372161060 / 371748336
Total CPU difference: 48183.93000000015 / 48295.23000000005

Testing on Windows:
Total MEMORY difference: 275294604 / 273048988
Total CPU difference: 38016.71875 / 37049.625
(0034033)
git   
2014-11-05 12:49   
Branch CR25418_4 has been created by abv.

SHA-1: 3972b056337c98762d2e44d9d4ea3a0a5006b227


Detailed log of new commits:

Author: abv
Date: Tue Oct 28 12:41:04 2014 +0300

    0025418: Debug output to be limited to OCC development environment
    
    Macros ending on "DEB" are replaced by OCCT_DEBUG across OCCT code; new macros described in documentation.
    Macros starting with DEB are changed to start with "OCCT_DEBUG_".
    Some code cleaned.
(0034341)
git   
2014-11-12 09:54   
Branch CR25418 has been deleted by inv.

SHA-1: c2a717fddbb88b7680181126b955779272a35fe3
(0034342)
git   
2014-11-12 09:54   
Branch CR25418_2 has been deleted by inv.

SHA-1: dde1a635639e7b7908ee193a18d8ac4e568b4c0d
(0034343)
git   
2014-11-12 09:55   
Branch CR25418_3 has been deleted by inv.

SHA-1: 1eff37863447b63de5b28cca9eae5b2f6139e23d
(0034344)
git   
2014-11-12 09:55   
Branch CR25418_4 has been deleted by inv.

SHA-1: 3972b056337c98762d2e44d9d4ea3a0a5006b227