CLOUDSTACK-1746: fix logging warning in usage server

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f6c1a1d0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f6c1a1d0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f6c1a1d0

Branch: refs/heads/marvin-refactor
Commit: f6c1a1d04f46554c8105cfb8f5ff266ce6b9d055
Parents: 4fb88f0
Author: Kelven Yang <[email protected]>
Authored: Fri Mar 29 13:44:12 2013 -0700
Committer: Prasanna Santhanam <[email protected]>
Committed: Sat Mar 30 22:21:55 2013 +0530

----------------------------------------------------------------------
 usage/src/com/cloud/usage/UsageServer.java |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f6c1a1d0/usage/src/com/cloud/usage/UsageServer.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/UsageServer.java 
b/usage/src/com/cloud/usage/UsageServer.java
index 881962f..b2d0ecb 100644
--- a/usage/src/com/cloud/usage/UsageServer.java
+++ b/usage/src/com/cloud/usage/UsageServer.java
@@ -17,12 +17,14 @@
 package com.cloud.usage;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.log4j.xml.DOMConfigurator;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.util.Log4jConfigurer;
 
 import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.component.ComponentContext;
@@ -75,12 +77,21 @@ public class UsageServer {
     static private void initLog4j() {
        File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
        if (file != null) {
-        s_logger.info("log4j configuration found at " + 
file.getAbsolutePath());
-        DOMConfigurator.configureAndWatch(file.getAbsolutePath());
+               System.out.println("log4j configuration found at " + 
file.getAbsolutePath());
+               try {
+                               
Log4jConfigurer.initLogging(file.getAbsolutePath());
+                       } catch (FileNotFoundException e) {
+                       }
+               DOMConfigurator.configureAndWatch(file.getAbsolutePath());
+
            } else {
                file = PropertiesUtil.findConfigFile("log4j-cloud.properties");
                if (file != null) {
-                   s_logger.info("log4j configuration found at " + 
file.getAbsolutePath());
+                       System.out.println("log4j configuration found at " + 
file.getAbsolutePath());
+                       try {
+                                       
Log4jConfigurer.initLogging(file.getAbsolutePath());
+                               } catch (FileNotFoundException e) {
+                               }
                    
PropertyConfigurator.configureAndWatch(file.getAbsolutePath());
                }
            }

Reply via email to