android中的Log.d()或Log.e()打印出不需要的额外文本

Man*_*dia 11 logging android

看看图像以获得更多想法当我只是在Android应用程序中记录消息时,Android Monitor会打印太多额外的垃圾文本,例如:代码:

Log.d(TAG, "From: " + "34369257099");
Log.d(TAG, "Message Notification Body: " + "Hello");
Run Code Online (Sandbox Code Playgroud)

android监视器输出:

10-01 14:15:33.262 18193-23771/com.xxxxx.xxxxxx D/MyFirebaseMsgService: From: 34369257099
10-01 14:15:33.262 18193-23771/com.xxxxx.xxxxxx D/MyFirebaseMsgService: Message Notification Body: Hello

[ 10-01 14:15:33.490 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9871) p->msg.arg1(0) OPEN


[ 10-01 14:15:33.490 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/net/xt_qtaguid/stats | grep 10206

[ 10-01 14:15:33.527 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:33.686 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9872) p->msg.arg1(0) OPEN


[ 10-01 14:15:33.686 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/18193/stat

[ 10-01 14:15:33.701 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:33.723 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9873) p->msg.arg1(0) OPEN


[ 10-01 14:15:33.723 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/stat

[ 10-01 14:15:33.740 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:34.051 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9874) p->msg.arg1(0) OPEN


[ 10-01 14:15:34.051 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/net/xt_qtaguid/stats | grep 10206

[ 10-01 14:15:34.086 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:34.258 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9875) p->msg.arg1(0) OPEN


[ 10-01 14:15:34.258 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/18193/stat

[ 10-01 14:15:34.274 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:34.294 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9876) p->msg.arg1(0) OPEN


[ 10-01 14:15:34.294 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/stat

[ 10-01 14:15:34.315 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:34.613 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9877) p->msg.arg1(0) OPEN


[ 10-01 14:15:34.613 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/net/xt_qtaguid/stats | grep 10206

[ 10-01 14:15:34.648 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:34.831 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9878) p->msg.arg1(0) OPEN


[ 10-01 14:15:34.831 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/18193/stat

[ 10-01 14:15:34.849 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:34.867 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9879) p->msg.arg1(0) OPEN


[ 10-01 14:15:34.867 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/stat

[ 10-01 14:15:34.885 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:35.176 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9880) p->msg.arg1(0) OPEN


[ 10-01 14:15:35.176 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/net/xt_qtaguid/stats | grep 10206

[ 10-01 14:15:35.210 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:35.404 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9881) p->msg.arg1(0) OPEN


[ 10-01 14:15:35.404 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/18193/stat

[ 10-01 14:15:35.421 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:35.439 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9882) p->msg.arg1(0) OPEN


[ 10-01 14:15:35.439 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/stat

[ 10-01 14:15:35.457 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:35.738 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9883) p->msg.arg1(0) OPEN


[ 10-01 14:15:35.738 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/net/xt_qtaguid/stats | grep 10206

[ 10-01 14:15:35.764 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:35.974 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9884) p->msg.arg1(0) OPEN


[ 10-01 14:15:35.974 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/18193/stat

[ 10-01 14:15:35.990 19060:19060 E/         ]
[adb] cuurent command is A_CLSE 


[ 10-01 14:15:36.009 19060:19060 E/         ]
[adb] handle_packet() t->online(1) p->msg.arg0(9885) p->msg.arg1(0) OPEN


[ 10-01 14:15:36.009 19060:19060 E/         ]
[adb] handle the adb command, and the command = adb shell:cat /proc/stat
Run Code Online (Sandbox Code Playgroud)

你能帮我解决一下吗?我的意思是为什么要打印这些额外的文字?我该如何摆脱这个?我使用过滤器只显示与包相关的日志,并尝试过滤TAG.但是在附图中看到仍然在一些日志中打印垃圾文本.

提前致谢

nan*_*ito 0

它们是来自另一个进程的日志。您无法阻止它们发生,因此您必须过滤日志输出以仅显示您感兴趣的内容。