|
17 | 17 | package com.cloud.usage; |
18 | 18 |
|
19 | 19 | import java.io.File; |
| 20 | +import java.io.FileNotFoundException; |
20 | 21 |
|
21 | 22 | import org.apache.log4j.Logger; |
22 | 23 | import org.apache.log4j.PropertyConfigurator; |
23 | 24 | import org.apache.log4j.xml.DOMConfigurator; |
24 | 25 | import org.springframework.context.ApplicationContext; |
25 | 26 | import org.springframework.context.support.ClassPathXmlApplicationContext; |
| 27 | +import org.springframework.util.Log4jConfigurer; |
26 | 28 |
|
27 | 29 | import com.cloud.utils.PropertiesUtil; |
28 | 30 | import com.cloud.utils.component.ComponentContext; |
@@ -75,12 +77,21 @@ public void destroy() { |
75 | 77 | static private void initLog4j() { |
76 | 78 | File file = PropertiesUtil.findConfigFile("log4j-cloud.xml"); |
77 | 79 | 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 | + |
80 | 87 | } else { |
81 | 88 | file = PropertiesUtil.findConfigFile("log4j-cloud.properties"); |
82 | 89 | 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 | + } |
84 | 95 | PropertyConfigurator.configureAndWatch(file.getAbsolutePath()); |
85 | 96 | } |
86 | 97 | } |
|
0 commit comments