mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-1746: fix logging warning in usage server
This commit is contained in:
parent
5782abf8f8
commit
f8471e545f
@ -17,12 +17,14 @@
|
|||||||
package com.cloud.usage;
|
package com.cloud.usage;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.log4j.PropertyConfigurator;
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.apache.log4j.xml.DOMConfigurator;
|
import org.apache.log4j.xml.DOMConfigurator;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
import org.springframework.util.Log4jConfigurer;
|
||||||
|
|
||||||
import com.cloud.utils.PropertiesUtil;
|
import com.cloud.utils.PropertiesUtil;
|
||||||
import com.cloud.utils.component.ComponentContext;
|
import com.cloud.utils.component.ComponentContext;
|
||||||
@ -75,12 +77,21 @@ public class UsageServer {
|
|||||||
static private void initLog4j() {
|
static private void initLog4j() {
|
||||||
File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
|
File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
s_logger.info("log4j configuration found at " + file.getAbsolutePath());
|
System.out.println("log4j configuration found at " + file.getAbsolutePath());
|
||||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
try {
|
||||||
|
Log4jConfigurer.initLogging(file.getAbsolutePath());
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
}
|
||||||
|
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
file = PropertiesUtil.findConfigFile("log4j-cloud.properties");
|
file = PropertiesUtil.findConfigFile("log4j-cloud.properties");
|
||||||
if (file != null) {
|
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());
|
PropertyConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user