Commit 72c4d3d6 authored by Andre Freyssinet's avatar Andre Freyssinet

Logging enhancements.

parent f58d4117
......@@ -1265,17 +1265,19 @@ public final class AgentServer {
String tname = dis.readUTF();
transaction = (Transaction) Class.forName(tname).newInstance();
} catch (Exception exc) {
logmon.log(BasicLevel.FATAL,
getName() + ", can't instantiate transaction manager", exc);
throw new Exception("Can't instantiate transaction manager");
if (logmon.isLoggable(BasicLevel.DEBUG))
logmon.log(BasicLevel.FATAL,
getName() + ", can't instantiate transaction manager", exc);
throw new Exception("Can't instantiate transaction manager: " + exc.getMessage());
} finally {
if (dis != null) dis.close();
}
try {
transaction.init(path);
} catch (IOException exc) {
logmon.log(BasicLevel.FATAL,
getName() + ", can't start transaction manager", exc);
if (logmon.isLoggable(BasicLevel.DEBUG))
logmon.log(BasicLevel.FATAL,
getName() + ", can't start transaction manager", exc);
throw new Exception("Can't start transaction manager: " + exc.getMessage());
}
} else {
......@@ -1504,8 +1506,7 @@ public final class AgentServer {
ServiceDesc services[] = AgentServer.getServices();
if (services != null) {
if (updatecfg != null) {
logmon.log(BasicLevel.INFO,
getName() + ", Updates ServiceManager");
logmon.log(BasicLevel.INFO, getName() + ", Updates ServiceManager");
Set<String> list = ServiceManager.listServices();
for (int i = 0; i < services.length; i ++) {
......@@ -1520,13 +1521,11 @@ public final class AgentServer {
}
}
} else {
logmon.log(BasicLevel.WARN,
getName() + ", no services from configuration");
logmon.log(BasicLevel.WARN, getName() + ", no services from configuration");
}
ServiceManager.save();
} catch (Exception exc) {
logmon.log(BasicLevel.FATAL,
getName() + ", can't initialize services", exc);
logmon.log(BasicLevel.FATAL, getName() + ", can't initialize services", exc);
throw new Exception("Can't initialize services");
}
......@@ -1552,7 +1551,10 @@ public final class AgentServer {
logmon.log(BasicLevel.ERROR, getName() + " jmx failed", exc);
}
} catch (Exception exc) {
logmon.log(BasicLevel.ERROR, getName() + "Cannot initialize", exc);
if (logmon.isLoggable(BasicLevel.DEBUG))
logmon.log(BasicLevel.ERROR, getName() + " cannot initialize", exc);
else
logmon.log(BasicLevel.ERROR, getName() + " cannot initialize: " + exc.getMessage());
synchronized(status) {
// AF: Will be replaced by a BAD_INITIALIZED status allowing the
// re-initialization..
......@@ -1560,7 +1562,10 @@ public final class AgentServer {
}
throw exc;
} catch (Throwable t) {
logmon.log(BasicLevel.ERROR, getName() + "Cannot initialize", t);
if (logmon.isLoggable(BasicLevel.DEBUG))
logmon.log(BasicLevel.ERROR, getName() + " cannot initialize", t);
else
logmon.log(BasicLevel.ERROR, getName() + " cannot initialize: " + t.getMessage());
synchronized(status) {
// AF: Will be replaced by a BAD_INITIALIZED status allowing the
// re-initialization..
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment