{"id":791,"date":"2015-06-17T11:00:11","date_gmt":"2015-06-17T03:00:11","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=791"},"modified":"2026-08-18T12:58:41","modified_gmt":"2026-08-18T04:58:41","slug":"android%e8%b0%83%e8%af%95%e5%b7%a5%e5%85%b7logcat","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=791","title":{"rendered":"Android\u8c03\u8bd5\u5de5\u5177LogCat"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\">\u5199\u7a0b\u5e8f\u96be\u514d\u51fa\u9519\u3002Java \u684c\u9762\u7a0b\u5e8f\u7684\u62a5\u9519\u53ef\u4ee5\u770b\u63a7\u5236\u53f0\uff1bAndroid \u63a7\u5236\u53f0\u66f4\u591a\u662f App \u52a0\u8f7d\u542f\u52a8\u4fe1\u606f\uff0c\u771f\u6b63\u7684\u7a0b\u5e8f\u65e5\u5fd7\u8981\u9760 <strong>LogCat<\/strong>\u3002\u5b83\u53ef\u4ee5\u6293\u4f4f Dalvik \u865a\u62df\u673a\u3001\u8fdb\u7a0b\u3001ActivityManager\u3001PackageManager\u3001\u8fd0\u884c\u65f6\u4ee5\u53ca\u5e94\u7528\u81ea\u5df1\u6253\u51fa\u6765\u7684\u4fe1\u606f\u3002<\/p>\n<\/blockquote>\n<p><!--more--><\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e00\u3001\u5728 Eclipse \u91cc\u6253\u5f00 LogCat<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u6253\u5f00 Eclipse \u540e\uff1aWindow \u2192 Show View \u2192 Other\uff0c\u518d\u5728 Android \u2192 LogCat \u91cc\u9009\u4e2d\u3002LogCat \u4f1a\u51fa\u73b0\u5728 Eclipse \u4e0b\u65b9\u533a\u57df\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u53f3\u4e0a\u65b9\u51e0\u4e2a\u5b57\u6bcd\u5bf9\u5e94\u4e0d\u540c\u7c7b\u578b\u7684\u65e5\u5fd7\uff08\u989c\u8272\u8d8a\u7a81\u51fa\u7ea7\u522b\u8d8a\u9ad8\uff09\uff1a<\/p>\n<table style=\"border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; text-align: left; overflow: auto; display: table; overflow-wrap: break-word; word-break: break-all;\" width=\"817\">\n<thead>\n<tr>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u7ea7\u522b<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u542b\u4e49<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u989c\u8272 \/ \u4f18\u5148\u7ea7<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">V Verbose<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u8be6\u7ec6\u4fe1\u606f<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u9ed1\u8272\uff0c\u7ea7\u522b\u6700\u4f4e<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">D Debug<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u8c03\u8bd5\u4fe1\u606f<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u84dd\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">I Info<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u901a\u544a\u4fe1\u606f<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u7eff\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">W Warn<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u8b66\u544a<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u6a59\u8272<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">E Error<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u9519\u8bef<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u7ea2\u8272\uff0c\u7ea7\u522b\u6700\u9ad8<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">Assert<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u65ad\u8a00\u5931\u8d25<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u8f83\u65b0\u7248\u672c\u52a0\u5165<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 1em 0px;\">\u70b9\u67d0\u4e2a\u5b57\u6bcd\u56fe\u6807\uff0c\u4f1a\u663e\u793a\u8be5\u7ea7\u522b\u4ee5\u53ca\u66f4\u9ad8\u7ea7\u522b\u7684\u65e5\u5fd7\uff0c\u4f4e\u4e8e\u6240\u9009\u7ea7\u522b\u7684\u5219\u4e0d\u663e\u793a\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001\u4ee3\u7801\u91cc\u600e\u4e48\u6253\u65e5\u5fd7<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u5148\u5f15\u5165 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">android.util.Log<\/code>\uff0c\u518d\u7528\u5bf9\u5e94\u65b9\u6cd5\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">Log.v(tag, message); \/\/ Verbose\nLog.d(tag, message); \/\/ Debug\nLog.i(tag, message); \/\/ Info\nLog.w(tag, message); \/\/ Warn\nLog.e(tag, message); \/\/ Error<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u4e24\u4e2a\u53c2\u6570\u90fd\u662f String\uff1a\u7b2c\u4e00\u4e2a\u662f\u65e5\u5fd7\u6807\u7b7e tag\uff08\u7528\u6765\u6807\u8bb0\u6d4b\u8bd5\u4f4d\u7f6e\uff09\uff0c\u7b2c\u4e8c\u4e2a\u662f\u5b9e\u9645\u5185\u5bb9\u3002\u7a0b\u5e8f\u8dd1\u5230\u8fd9\u4e9b\u300c\u65e5\u5fd7\u70b9\u300d\u65f6\uff0c\u4fe1\u606f\u4f1a\u8fdb LogCat\u3002\u62ff\u663e\u793a\u5185\u5bb9\u548c\u9884\u671f\u5bf9\u6bd4\uff0c\u5c31\u80fd\u8fc5\u901f\u5b9a\u4f4d\u300c\u51fa\u4e8b\u5730\u70b9\u300d\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e09\u3001\u4e3b\u7a97\u53e3\u5217\u542b\u4e49\u4e0e\u8fc7\u6ee4<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">LogCat \u4e3b\u7a97\u53e3\u5404\u5217\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/db3.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-792\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/db3.png\" alt=\"db3\" width=\"538\" height=\"39\" srcset=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/db3.png 773w, https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/db3-678x49.png 678w, https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/db3-528x38.png 528w\" sizes=\"(max-width: 538px) 100vw, 538px\" \/><\/a><\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section><strong>Level<\/strong>\uff1a\u65e5\u5fd7\u7ea7\u522b\uff0c\u4e0e Log.v \u7b49\u5bf9\u5e94<\/section>\n<\/li>\n<li>\n<section><strong>Time<\/strong>\uff1a\u53d1\u751f\u65f6\u95f4<\/section>\n<\/li>\n<li>\n<section><strong>PID<\/strong>\uff1a\u8fdb\u7a0b\u6807\u8bc6<\/section>\n<\/li>\n<li>\n<section><strong>TID<\/strong>\uff1a\u7ebf\u7a0b\u76f8\u5173\uff08\u539f\u6587\u8bb0\u4e3a ProcessStats\uff09<\/section>\n<\/li>\n<li>\n<section><strong>Application<\/strong>\uff1a\u5e94\u7528\u7a0b\u5e8f<\/section>\n<\/li>\n<li>\n<section><strong>Tag<\/strong>\uff1a\u65e5\u5fd7\u6807\u7b7e<\/section>\n<\/li>\n<li>\n<section><strong>Text<\/strong>\uff1a\u5185\u5bb9<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">\u8fc7\u6ee4\u65f6\u6309 tag\u3001\u7ea7\u522b\u6216\u5305\u540d\u6536\u7a84\u8303\u56f4\uff0c\u6bd4\u5728\u6574\u5c4f\u5237\u65e5\u5fd7\u91cc\u8089\u773c\u627e\u5feb\u5f97\u591a\u3002<\/p>\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\"><strong>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1aAndroid \u6392\u9519\u770b LogCat\uff0c\u4e0d\u770b\u666e\u901a\u63a7\u5236\u53f0\uff1b\u7528 Log.v\/d\/i\/w\/e \u6253\u5e26 tag \u7684\u70b9\uff0c\u518d\u6309\u7ea7\u522b\u548c\u8fc7\u6ee4\u6761\u4ef6\u5bf9\u51c6\u300c\u51fa\u4e8b\u5730\u70b9\u300d\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u5199\u7a0b\u5e8f\u96be\u514d\u51fa\u9519\u3002Java \u684c\u9762\u7a0b\u5e8f\u7684\u62a5\u9519\u53ef\u4ee5\u770b\u63a7\u5236\u53f0\uff1bAndroid \u63a7\u5236\u53f0\u66f4\u591a\u662f App \u52a0\u8f7d\u542f\u52a8\u4fe1\u606f\uff0c\u771f\u6b63 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[194,12],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/791"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=791"}],"version-history":[{"count":2,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/791\/revisions"}],"predecessor-version":[{"id":794,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/791\/revisions\/794"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}