You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2019/02/07 16:47:54 UTC

[GitHub] DaanHoogland edited a comment on issue #2992: PoC for log library surface reduction (2991)

DaanHoogland edited a comment on issue #2992: PoC for log library surface reduction (2991)
URL: https://github.com/apache/cloudstack/pull/2992#issuecomment-461505256
 
 
   used a addepted version of @rafaelweingartner's script above : 
   ```
   #!/bin/bash
   CLOUDSTACK_FOLDER="."
   
   ALL_CLOUDSTACK_CLASSES=$(find $CLOUDSTACK_FOLDER -name "*.java")
   
   for class in $ALL_CLOUDSTACK_CLASSES
   do
     count=$((count+1))
     echo "Processing ($count) class: $class"
   
     echo "Replacing org.apache.log4j.Level with org.apache.cloudstack.utils.log.Level"
     sed -i .loch 's/org.apache.log4j.Level/org.apache.cloudstack.utils.log.Level/g' "$class"
   
     echo "Replacing org.apache.log4j.Logger with org.apache.cloudstack.utils.log.Logger"
     sed -i .loch 's/org.apache.log4j.Logger/org.apache.cloudstack.utils.log.Logger/g' "$class"
   
     echo "Replacing java.util.logging.Logger with org.apache.cloudstack.utils.log.Logger"
     sed -i .loch 's/java.util.logging.Logger/org.apache.cloudstack.utils.log.Logger/g' "$class"
   
     echo "Adding import to org.apache.cloudstack.utils.log.LogFactory"
     sed -i .loch '/import org.apache.cloudstack.utils.log.Logger/a \
   import org.apache.cloudstack.utils.log.LogFactory;
   ' "$class"
   
     echo "Replacing Logger.getLogger with LogFactory.getLogger"
     sed -i .loch 's/Logger.getLogger/LogFactory.getLogger/g' "$class"
   
     echo "Replacing org.slf4j.Logger with org.apache.cloudstack.utils.log.Logger"
     sed -i .loch 's/org.slf4j.Logger/org.apache.cloudstack.utils.log.Logger/g' "$class"
   
     echo "Replacing org.slf4j.LoggerFactory with org.apache.cloudstack.utils.log.LogFactory"
     sed -i .loch 's/org.slf4j.LoggerFactory/org.apache.cloudstack.utils.log.LogFactory/g' "$class"
   
     echo "Replacing s_logger with LOG"
     sed -i .loch 's/s_logger/LOG/g' "$class"
   done
   ```
   the above scripts leaves some to be desired like:
   #
   
   1. I don't have a constructor taking a String, yet. there where only a handful of those and all used a Class.getname, so I converted the calls instead.
   1. on occasion the script led to a double insertion of the factory import. fixed those by hand as well

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services