Skip to content

Commit 80c588e

Browse files
kelvenychipchilders
authored andcommitted
CLOUDSTACK-1746: fix logging warning in usage server
1 parent 2e395b8 commit 80c588e

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎usage/src/com/cloud/usage/UsageServer.java‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
package com.cloud.usage;
1818

1919
import java.io.File;
20+
import java.io.FileNotFoundException;
2021

2122
import org.apache.log4j.Logger;
2223
import org.apache.log4j.PropertyConfigurator;
2324
import org.apache.log4j.xml.DOMConfigurator;
2425
import org.springframework.context.ApplicationContext;
2526
import org.springframework.context.support.ClassPathXmlApplicationContext;
27+
import org.springframework.util.Log4jConfigurer;
2628

2729
import com.cloud.utils.PropertiesUtil;
2830
import com.cloud.utils.component.ComponentContext;
@@ -75,12 +77,21 @@ public void destroy() {
7577
static private void initLog4j() {
7678
File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
7779
if (file != null) {
78-
s_logger.info("log4j configuration found at " + file.getAbsolutePath());
79-
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
80+
System.out.println("log4j configuration found at " + file.getAbsolutePath());
81+
try {
82+
Log4jConfigurer.initLogging(file.getAbsolutePath());
83+
} catch (FileNotFoundException e) {
84+
}
85+
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
86+
8087
} else {
8188
file = PropertiesUtil.findConfigFile("log4j-cloud.properties");
8289
if (file != null) {
83-
s_logger.info("log4j configuration found at " + file.getAbsolutePath());
90+
System.out.println("log4j configuration found at " + file.getAbsolutePath());
91+
try {
92+
Log4jConfigurer.initLogging(file.getAbsolutePath());
93+
} catch (FileNotFoundException e) {
94+
}
8495
PropertyConfigurator.configureAndWatch(file.getAbsolutePath());
8596
}
8697
}

0 commit comments

Comments
 (0)