奇怪的日志.i()行为安卓工作室



我看到了一些非常奇怪的东西。我正在进行http post请求

HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = null;
try {
response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
String strResponse = null;
if (entity != null) {
strResponse = EntityUtils.toString(entity);
Log.i("SetupAutoCardResponse",String.valueOf(strResponse));
Log.i("otherTest","test");
Log.i("otherTest",strResponse);
return true;
}
} catch (IOException e) {
e.printStackTrace();
return false;
}

我在日志中看到的唯一输出是otherTest : Test。带有strResponse的日志根本不显示,我的意思是,什么都不显示。它看起来不像这个SetupAutoCardResponse : nullotherTest: null。绝对什么也没出现。但我知道我得到了回应。表达式返回true

在日志中,如果消息为Null、Blank或Empty,则日志不会写下。示例:Log.i(TAG、MSG(;为了确保它有效,我们可以在MSG 中添加一些文本

Log.i(TAG, String.format("%s %s", "MSG>" , MSG));

相关内容

最新更新