agent: Log4j should not be initialized in the main method

Since we use JSVC we don't execute the main method, but it is still
there for manually running the Agent.

Initializing log4j in the start method makes sure it also works with JSVC
This commit is contained in:
Wido den Hollander 2013-03-06 16:41:39 +01:00
parent a1ca7e09ca
commit a4521551a3

View File

@ -553,6 +553,9 @@ public class AgentShell implements IAgentShell {
public void start() { public void start() {
try { try {
/* By default we only search for log4j.xml */
LogUtils.initLog4j("log4j-cloud.xml");
System.setProperty("java.net.preferIPv4Stack", "true"); System.setProperty("java.net.preferIPv4Stack", "true");
String instance = getProperty(null, "instance"); String instance = getProperty(null, "instance");
@ -612,8 +615,6 @@ public class AgentShell implements IAgentShell {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
LogUtils.initLog4j("log4j-cloud.xml");
AgentShell shell = new AgentShell(); AgentShell shell = new AgentShell();
shell.init(args); shell.init(args);
shell.start(); shell.start();