Martin Peřina has uploaded a new change for review.

Change subject: core: Replace log4j with slf4j in branding
......................................................................

core: Replace log4j with slf4j in branding

Replaces log4j with slf4j in branding module.

Change-Id: I8367326c229fe9eaee18258c2a477507958c3ad4
Bug-Url: https://bugzilla.redhat.com/1109871
Signed-off-by: Martin Perina <[email protected]>
---
M 
backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingFilter.java
M 
backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingServlet.java
M 
backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java
M 
backend/manager/modules/branding/src/main/modules/org/ovirt/engine/core/branding/main/module.xml
4 files changed, 26 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/77/34177/1

diff --git 
a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingFilter.java
 
b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingFilter.java
index 262d659..50f1f99 100644
--- 
a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingFilter.java
+++ 
b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingFilter.java
@@ -14,8 +14,9 @@
 import javax.servlet.jsp.jstl.core.Config;
 import javax.servlet.jsp.jstl.fmt.LocalizationContext;
 
-import org.apache.log4j.Logger;
 import org.ovirt.engine.core.utils.servlet.LocaleFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The branding filter adds the appropriate attributes to the {@code 
HttpServletRequest} for the Servlet to be
@@ -26,7 +27,7 @@
     /**
      * Logger.
      */
-    private static final Logger log = Logger.getLogger(BrandingFilter.class);
+    private static final Logger log = 
LoggerFactory.getLogger(BrandingFilter.class);
 
     /**
      * A blank string.
@@ -58,7 +59,7 @@
             throws IOException, ServletException {
         Locale userLocale = (Locale) request.getAttribute(LocaleFilter.LOCALE);
         if (userLocale == null) {
-            log.warn("Detected Locale is null, setting to default: " + 
LocaleFilter.DEFAULT_LOCALE);
+            log.warn("Detected Locale is null, setting to default '{}'", 
LocaleFilter.DEFAULT_LOCALE);
             userLocale = LocaleFilter.DEFAULT_LOCALE;
         }
         List<BrandingTheme> brandingThemes = 
brandingManager.getBrandingThemes();
diff --git 
a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingServlet.java
 
b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingServlet.java
index 8474bed..5355dc6 100644
--- 
a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingServlet.java
+++ 
b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingServlet.java
@@ -8,8 +8,9 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.log4j.Logger;
 import org.ovirt.engine.core.utils.servlet.ServletUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class serves files from the branding themes to the browser. This
@@ -23,7 +24,7 @@
     /**
      * The logger object.
      */
-    private static final Logger log = Logger.getLogger(BrandingServlet.class);
+    private static final Logger log = 
LoggerFactory.getLogger(BrandingServlet.class);
 
     /**
      * The branding manager, it resolves relative paths to the Servlet into
@@ -64,7 +65,7 @@
             // Return a result relative to the branding root path.
             result = new File(mergedPath);
         } else {
-            log.error("The path \"" + mergedPath + "\" is not sane"); 
//$NON-NLS-1$ //$NON-NLS-2$
+            log.error("The path '{}' is not sane", mergedPath); //$NON-NLS-1$
         }
         return result;
     }
diff --git 
a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java
 
b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java
index 915a85a..e7d88fc 100644
--- 
a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java
+++ 
b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java
@@ -18,8 +18,9 @@
 import java.util.Properties;
 import java.util.ResourceBundle;
 
-import org.apache.log4j.Logger;
 import org.ovirt.engine.core.utils.servlet.LocaleFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class represents the components of an available theme. There are
@@ -34,7 +35,7 @@
     /**
      * The logger.
      */
-    private static final Logger log = Logger.getLogger(BrandingTheme.class);
+    private static final Logger log = 
LoggerFactory.getLogger(BrandingTheme.class);
 
     /**
      * The key for the messages resource bundle name.
@@ -138,8 +139,9 @@
             brandingProperties.load(propertiesFile);
             available = supportedBrandingVersion == 
getVersion(brandingProperties);
             if (!available) {
-                log.warn("Unable to load branding theme, mismatched version: " 
//$NON-NLS-1$
-                    + getVersion(brandingProperties) + " wanted version: " + 
supportedBrandingVersion); //$NON-NLS-1$
+                log.warn("Unable to load branding theme, mismatched version 
'{}' wanted version '{}'", //$NON-NLS-1$
+                        getVersion(brandingProperties),
+                        supportedBrandingVersion);
             } else {
                 available = verifyPropertyValues(brandingProperties);
                 if (!available) {
@@ -148,9 +150,9 @@
             }
         } catch (IOException e) {
             // Unable to load properties file, disable theme.
-            log.warn("Unable to load properties file for " //$NON-NLS-1$
-                    + "theme located here:"//$NON-NLS-1$
-                    + propertiesFileName, e);
+            log.warn("Unable to load properties file for theme located here 
'{}'", //$NON-NLS-1$
+                    propertiesFileName,
+                    e);
         }
         return available;
     }
@@ -164,7 +166,7 @@
         if (brandingProperties.getProperty(REPLACE_TEMPLATE_KEY) != null &&
             !Arrays.asList(TEMPLATE_REPLACE_VALUES).contains(
                     
brandingProperties.getProperty(REPLACE_TEMPLATE_KEY).toLowerCase())) {
-            log.warn(REPLACE_TEMPLATE_KEY + " value is not true or false"); 
//$NON-NLS-1$
+            log.warn("'{}' value is not true or false", REPLACE_TEMPLATE_KEY); 
//$NON-NLS-1$
             result = false;
         }
         return result;
@@ -258,16 +260,17 @@
                     result.add(ResourceBundle.getBundle(bundleName, locale, 
urlLoader));
                 }
             } else {
-                log.warn("Theme " + this.getPath() + " has no property defined 
for key " //$NON-NLS-1$ //$NON-NLS-2$
-                        + name);
+                log.warn("Theme '{}' has no property defined for key '{}'", 
//$NON-NLS-1$
+                        this.getPath(),
+                        name);
             }
         } catch (IOException e) {
             // Unable to load messages resource bundle.
-            log.warn("Unable to read resources resource " //$NON-NLS-1$
-                    + "bundle, returning null", e); //$NON-NLS-1$
+            log.warn("Unable to read resources resource bundle, returning 
null", e); //$NON-NLS-1$
         } catch (MissingResourceException mre) {
-            log.warn("Theme " + this.getPath() + " is missing ResourceBundle " 
//$NON-NLS-1$ //$NON-NLS-2$
-                    + lastProcessedBundle);
+            log.warn("Theme '{}' is missing ResourceBundle '{}'", //$NON-NLS-1$
+                    this.getPath(),
+                    lastProcessedBundle);
         }
 
         return result;
diff --git 
a/backend/manager/modules/branding/src/main/modules/org/ovirt/engine/core/branding/main/module.xml
 
b/backend/manager/modules/branding/src/main/modules/org/ovirt/engine/core/branding/main/module.xml
index 44ced64..dcf271f 100644
--- 
a/backend/manager/modules/branding/src/main/modules/org/ovirt/engine/core/branding/main/module.xml
+++ 
b/backend/manager/modules/branding/src/main/modules/org/ovirt/engine/core/branding/main/module.xml
@@ -25,10 +25,10 @@
   <dependencies>
     <module name="javax.api"/>
     <module name="javax.servlet.api"/>
-    <module name="org.apache.log4j"/>
     <module name="org.codehaus.jackson.jackson-core-asl"/>
     <module name="org.codehaus.jackson.jackson-mapper-asl"/>
     <module name="org.ovirt.engine.core.utils"/>
+    <module name="org.slf4j"/>
   </dependencies>
 
 </module>


-- 
To view, visit http://gerrit.ovirt.org/34177
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8367326c229fe9eaee18258c2a477507958c3ad4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to