日志中不可见的信息。 [英] Information not visible in the logs.

查看:135
本文介绍了日志中不可见的信息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的日志中打印某些信息,但是当我尝试这样做时,日志中没有响应。



< b>我尝试了什么:



String articleID = jsonArray.getString(i);



url =新网址(https://hacker-news.firebaseio.com/v0/item/\"+ articleID +。json?print = pretty);



urlConnection =(HttpsURLConnection)url.openConnection();



in = urlConnection.getInputStream();



reader = new InputStreamReader(in);



String articleInfo =;



while(data!= -1){



char current =(char)data;



articleInfo + = current;



data = reader.read();



}



Log.i(ArticleInfo,articleInfo);

Hi, I am trying to print certain chunk of info in my logs, however when I try to do so there is no response in the logs.

What I have tried:

String articleID = jsonArray.getString(i);

url = new URL ("https://hacker-news.firebaseio.com/v0/item/"+ articleID + ".json?print=pretty");

urlConnection = (HttpsURLConnection) url.openConnection();

in = urlConnection.getInputStream();

reader = new InputStreamReader(in);

String articleInfo = "";

while (data != -1){

char current = (char) data;

articleInfo += current;

data = reader.read();

}

Log.i("ArticleInfo", articleInfo);

推荐答案

所以使用调试器,找出究竟发生了什么。

在该代码的第一行放置一个断点,然后运行你的应用程序。当调试器到达断点时,它将停止并将控制传递给您。然后,您可以查看变量内容,单步执行代码,甚至在运行时更改它。



您需要知道它返回的内容,是什么已处理 - 我们无法为您执行任何操作:我们无权访问 jsonArray i ,或者......

所以试一试,使用调试器,找出你正在使用的数据,以及它在代码中移动时会发生什么。



很抱歉,我们不能为您做任何事情!
So use the debugger, and find out what exactly is going on.
Put a breakpoint on the first line of that code, and run your app. When the debugger reaches the breakpoint, it will stop and pass control to you. You can then look at variable contents, single step your code, and even change it while it is running.

You need to know what it being returned, what is being processed - and we can't do any of that for you: We don't have access to jsonArray, or i, or ...
So give it a try, use the debugger, and find out what data you are using, and what happens to it as it moves through your code.

Sorry, but we can't do any of that for you!


这篇关于日志中不可见的信息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆