Re: Jackpot convert log4j to System.logger

2024-02-14 Thread Ernie Rael

Thanks Michael,

Yeah. I can do something like

   => $logger.log(System.Logger.Level.WARNING, $args$)

and the code ends up with

   logger.log(Logger.Level.WARNING, getColu...

Just putting the word "WARNING" ends up with compilation error since no 
import is added.


So I'll just write it to get the single word "WARNING", and then 
manually add "import static Level.*;" to the files.


I vaguely recall having problems in the past with static imports.

-ernie

On 24/02/14 10:20 PM, Michael Bien wrote:

Hi Ernie,

the imports block on top of the hints file is for the hints file 
itself. It is not added to the refactored sources or anything like that.


Imports are added automatically when the hint is applied if new 
imports are needed, there is no way to control this mechanism.


-mbien

On 15.02.24 07:09, Ernie Rael wrote:
Using the follow does most of the conversion work, requires some 
manual fixup for certain log4j arguments. But *import static 
java.lang.System.Logger.Level.*;* doesn't get added. Any suggestions 
for a way to add that as part of the refactoring?


-ernie

   

        org.apache.logging.log4j.Logger
   =>  java.lang.System.Logger
   ;;

   "error":
        $logger.error($args$)
   ::  $logger instanceof org.apache.logging.log4j.Logger
   =>  $logger.log(ERROR, $args$)
   ;;

   ...





-
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

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





Re: Jackpot convert log4j to System.logger

2024-02-14 Thread Michael Bien

Hi Ernie,

the imports block on top of the hints file is for the hints file itself. 
It is not added to the refactored sources or anything like that.


Imports are added automatically when the hint is applied if new imports 
are needed, there is no way to control this mechanism.


-mbien

On 15.02.24 07:09, Ernie Rael wrote:
Using the follow does most of the conversion work, requires some 
manual fixup for certain log4j arguments. But *import static 
java.lang.System.Logger.Level.*;* doesn't get added. Any suggestions 
for a way to add that as part of the refactoring?


-ernie

   

        org.apache.logging.log4j.Logger
   =>  java.lang.System.Logger
   ;;

   "error":
        $logger.error($args$)
   ::  $logger instanceof org.apache.logging.log4j.Logger
   =>  $logger.log(ERROR, $args$)
   ;;

   ...





-
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

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





Jackpot convert log4j to System.logger

2024-02-14 Thread Ernie Rael
Using the follow does most of the conversion work, requires some manual 
fixup for certain log4j arguments. But *import static 
java.lang.System.Logger.Level.*;* doesn't get added. Any suggestions for 
a way to add that as part of the refactoring?


-ernie

   

    org.apache.logging.log4j.Logger
   =>  java.lang.System.Logger
   ;;

   "error":
    $logger.error($args$)
   ::  $logger instanceof org.apache.logging.log4j.Logger
   =>  $logger.log(ERROR, $args$)
   ;;

   ...