Skip to content

Commit b9d4d65

Browse files
author
Alex Huang
committed
more logging to figure out problems with gson
1 parent 93c55c2 commit b9d4d65

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎client/tomcatconf/log4j-cloud.xml.in‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
<priority value="DEBUG"/>
6767
</category>
6868

69+
<category name="com.cloud.utils.nio">
70+
<priority value="INFO"/>
71+
</category>
72+
6973
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
7074
<category name="org.apache">
7175
<priority value="INFO"/>

‎core/src/com/cloud/agent/transport/Request.java‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,12 @@ public Command getCommand() {
221221

222222
public Command[] getCommands() {
223223
if (_cmds == null) {
224-
_cmds = s_gson.fromJson(_content, Command[].class);
224+
try {
225+
_cmds = s_gson.fromJson(_content, Command[].class);
226+
} catch (RuntimeException e) {
227+
s_logger.error("Caught problem with " + _content, e);
228+
throw e;
229+
}
225230
}
226231
return _cmds;
227232
}
@@ -313,9 +318,9 @@ protected String log(String msg, boolean logContent, Level level) {
313318
if (_cmds == null) {
314319
try {
315320
_cmds = s_gson.fromJson(_content, this instanceof Response ? Answer[].class : Command[].class);
316-
} catch (Exception e) {
321+
} catch (RuntimeException e) {
317322
s_logger.error("Unable to convert to json: " + _content);
318-
return null;
323+
throw e;
319324
}
320325
}
321326
try {

0 commit comments

Comments
 (0)