You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "mbien (via GitHub)" <gi...@apache.org> on 2023/12/14 10:07:40 UTC

[PR] Disable ANSI decorations for default (embedded) maven logger. [netbeans]

mbien opened a new pull request, #6843:
URL: https://github.com/apache/netbeans/pull/6843

   `maven-slf4j-provider` injects `MavenSimpleLogger` which decorates the output for terminal use. This causes problems in log files, tests etc which don't expect or cant display them properly.
   
   a quick way to test this:
   run `NexusRepositoryIndexerImplTest#testFilterPluginGroupIdsRepositoryQueries` directly from NB and check that there is no color in the stack trace. The `TEST-org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImplTest.xml` should also have no escaped ANSI symbols in it.
   
   long way to test would be to run NB and check that the log file is clean.
   this is how it should _not_ look:
   ![image](https://github.com/apache/netbeans/assets/114367/44c412be-403c-4fcb-8cde-cbd00adef61a)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Disable ANSI decorations for default (embedded) maven logger. [netbeans]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6843:
URL: https://github.com/apache/netbeans/pull/6843#discussion_r1426507958


##########
java/maven.embedder/src/org/netbeans/modules/maven/embedder/EmbedderFactory.java:
##########
@@ -56,6 +57,13 @@
  */
 public final class EmbedderFactory {
 
+    static{
+        // disable Maven's ANSI CLI decorations
+        // maven-slf4j-provider injects MavenSimpleLogger which decorates the output for terminal use
+        // this causes problems in log files, tests etc which don't expect or cant display them properly
+        MessageUtils.setColorEnabled(false);
+    }

Review Comment:
   @sdedic is this a good place to put it? My thinking is that this is probably the main entry point into the lib wrapper module.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Disable ANSI decorations for default (embedded) maven logger. [netbeans]

Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on PR #6843:
URL: https://github.com/apache/netbeans/pull/6843#issuecomment-1857400963

   A question: I understand it is desirable to disable ansi output for testing, but wouldn't it affect some IDE operations that use Embedder ? Would it be possible to disable the coloring conditionally (i.e. some system property set up by the test infrastructure) ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Disable ANSI decorations for default (embedded) maven logger. [netbeans]

Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #6843:
URL: https://github.com/apache/netbeans/pull/6843#discussion_r1429186005


##########
java/maven.embedder/nbproject/project.xml:
##########
@@ -319,9 +319,14 @@
             <class-path-extension>
                 <runtime-relative-path>../maven/lib/httpcore-4.4.16.jar</runtime-relative-path>
             </class-path-extension>
+            <!--
+            disable Maven's ANSI CLI decorations
+            maven-slf4j-provider injects MavenSimpleLogger which decorates the output for terminal use
+            this causes problems in log files, tests etc which don't expect or cant display them properly
             <class-path-extension>
                 <runtime-relative-path>../maven/lib/jansi-2.4.0.jar</runtime-relative-path>
             </class-path-extension>
+            -->

Review Comment:
   Great !!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Disable ANSI decorations for default (embedded) maven logger. [netbeans]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6843:
URL: https://github.com/apache/netbeans/pull/6843#discussion_r1427700908


##########
java/maven.embedder/nbproject/project.xml:
##########
@@ -319,9 +319,14 @@
             <class-path-extension>
                 <runtime-relative-path>../maven/lib/httpcore-4.4.16.jar</runtime-relative-path>
             </class-path-extension>
+            <!--
+            disable Maven's ANSI CLI decorations
+            maven-slf4j-provider injects MavenSimpleLogger which decorates the output for terminal use
+            this causes problems in log files, tests etc which don't expect or cant display them properly
             <class-path-extension>
                 <runtime-relative-path>../maven/lib/jansi-2.4.0.jar</runtime-relative-path>
             </class-path-extension>
+            -->

Review Comment:
   thats likely the best way to be 100% sure that it is working:
   here is the maven code:
   
   https://github.com/apache/maven/blob/3c65873b584945c034aeb4ba51a5793c6582b19d/maven-embedder/src/main/java/org/apache/maven/cli/jansi/MessageUtils.java#L52-L61
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Disable ANSI decorations for default (embedded) maven logger. [netbeans]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #6843:
URL: https://github.com/apache/netbeans/pull/6843#issuecomment-1857453055

   @sdedic I convert this back to draft since this trick isn't working anymore today for some reason.
   
   But regarding what is affected: the messags.log is ansi decorated too, the screenshot above is the log opened with my default text editor on linux (xed). This creates a mess when pasted into issue forms etc.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Disable ANSI decorations for default (embedded) maven logger. [netbeans]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien merged PR #6843:
URL: https://github.com/apache/netbeans/pull/6843


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists