androidの中のdmesg
4171 ワード
文章の出所:http://blog.csdn.net/shift_wwwx/articale/detail/42464265
Linuxコマンドdmesgは起動情報を表示するために使用されます.ケネルは起動情報をring bufferに格納します.起動時に情報が確認できない場合は、dmesgを利用して確認できます.起動情報は/var/logディレクトリにも保存されています.名前はdmesgのファイルにあります.(しかし、Androidシステムでは、このロゴはどこに保存されていますか?varのようなディレクトリがなく、さらなる探求が必要です.)
dmesg-print or control the kersnel ring buffer
説明:
dmesg カーネルリングバッファの検出と制御に使用します.プログラムは、ユーザがシステムの起動情報を理解するのを助けるために使用されます.ユーザはコマンドを使うだけです.
dmesg>boot.messages
そしてファイルブック.messageをいくつかのデバッグシステムの人に郵送します.手で情報をコピーする必要はありません.
パラメータ:-cは情報を表示し、リンクバーの内容をクリアします.
-Cクリア情報-sは8196に設定されていますが、ちょうどリングバfferのサイズに等しいです.-n記録情報の階層を設定します.
-Fはロゴの代わりにファイルを使います.
その他のパラメータ:
たとえば:
システム起動情報をファイルに保存:
$sudo dmesg>messages.txt
最近の情報を印刷出力:
$sudo dmesg tail-f
カーネルは、printk()によって出力される情報はログレベルを有し、ログレベルは、printk()が出力する文字列の前に、尖った括弧を有する整数を加えることによって制御される.カーネル中共は8つの異なるログレベルを提供しています.linux/kernel.hにはマクロ対応があります.define KERN_EMERG "<0>" /* system is unusable*/脚define KERN_ALERT "<1>" /* action must be taken immediately*/菗define KERN_CRIT "<2>" /* critical conditions*/鏢define KERN_ERR "<3>" /* error conditions*/菗define KERN_WARNING "<4>" /* warning conditions*/菗define KERN_NOTICE "<5>" /* normal but significant*/菗define KERN_FO "<6>" /* informational*/菗define KERN_DEBUG "<7>" /* debug-level messages*/だからprintkは、printk(KERNuINFO"Hello、world);
ログレベルが指定されていないprintk()で採用されているデフォルトのレベルはDEFAULT()です.MESSAGE_LOGLNEVELは、このマクロは、ケネル/printk.cで整数4と定義されています.即ち、KERN_に対応しています.WARNINGproc/sys/kersnel/printkでは、現在のコンソールログレベル、ログレベルが明確に指定されていないデフォルトメッセージログレベル、最小(最高)許可設定のコンソールログレベル、ブート時のデフォルトログレベルの4つの値が表示されます.printk()のメッセージログレベルが現在のコンソールログレベルより小さい場合、printkの情報がコンソール上に表示されます.しかし、現在の操作台のログレベルがどのような値であれ、/proc/kmsg(またはdmesgを使用する)を通じて常に確認されます.また、sylogdやklogdを設定して実行すると、コンソールに表示されていないprintkの情報も/var/logs/messages.logsに追加されます.コンソールのログレベルは読み書き/proc/sys/ケネル/printkファイルを読むことによって読み取られ、修正されます.このファイルを見る方法は以下の通りです. 4 1 7上に表示された4つのデータは、それぞれ、コンソールログレベル、デフォルトのメッセージログレベル、最低のコンソールログレベル、およびデフォルトのコンソールログレベルに対応します.
Linuxコマンドdmesgは起動情報を表示するために使用されます.ケネルは起動情報をring bufferに格納します.起動時に情報が確認できない場合は、dmesgを利用して確認できます.起動情報は/var/logディレクトリにも保存されています.名前はdmesgのファイルにあります.(しかし、Androidシステムでは、このロゴはどこに保存されていますか?varのようなディレクトリがなく、さらなる探求が必要です.)
dmesg-print or control the kersnel ring buffer
説明:
dmesg カーネルリングバッファの検出と制御に使用します.プログラムは、ユーザがシステムの起動情報を理解するのを助けるために使用されます.ユーザはコマンドを使うだけです.
dmesg>boot.messages
そしてファイルブック.messageをいくつかのデバッグシステムの人に郵送します.手で情報をコピーする必要はありません.
パラメータ:-cは情報を表示し、リンクバーの内容をクリアします.
-Cクリア情報-sは8196に設定されていますが、ちょうどリングバfferのサイズに等しいです.-n記録情報の階層を設定します.
-Fはロゴの代わりにファイルを使います.
その他のパラメータ:
Options:
-C, --clear clear the kernel ring buffer
-c, --read-clear read and clear all messages
-D, --console-off disable printing messages to console
-E, --console-on enable printing messages to console
-F, --file use the file instead of the kernel log buffer
-f, --facility restrict output to defined facilities
-H, --human human readable output
-k, --kernel display kernel messages
-L, --color[=] colorize messages (auto, always or never)
colors are enabled by default
-l, --level restrict output to defined levels
-n, --console-level set level of messages printed to console
-P, --nopager do not pipe output into a pager
-r, --raw print the raw message buffer
-S, --syslog force to use syslog(2) rather than /dev/kmsg
-s, --buffer-size buffer size to query the kernel ring buffer
-u, --userspace display userspace messages
-w, --follow wait for new messages
-x, --decode decode facility and level to readable string
-d, --show-delta show time delta between printed messages
-e, --reltime show local time and time delta in readable format
-T, --ctime show human readable timestamp (may be inaccurate!)
-t, --notime don't print messages timestamp
--time-format show time stamp using format:
[delta|reltime|ctime|notime|iso]
Suspending/resume will make ctime and iso timestamps inaccurate.
-h, --help display this help and exit
-V, --version output version information and exit
たとえば:
システム起動情報をファイルに保存:
$sudo dmesg>messages.txt
最近の情報を印刷出力:
$sudo dmesg tail-f
カーネルは、printk()によって出力される情報はログレベルを有し、ログレベルは、printk()が出力する文字列の前に、尖った括弧を有する整数を加えることによって制御される.カーネル中共は8つの異なるログレベルを提供しています.linux/kernel.hにはマクロ対応があります.define KERN_EMERG "<0>" /* system is unusable*/脚define KERN_ALERT "<1>" /* action must be taken immediately*/菗define KERN_CRIT "<2>" /* critical conditions*/鏢define KERN_ERR "<3>" /* error conditions*/菗define KERN_WARNING "<4>" /* warning conditions*/菗define KERN_NOTICE "<5>" /* normal but significant*/菗define KERN_FO "<6>" /* informational*/菗define KERN_DEBUG "<7>" /* debug-level messages*/だからprintkは、printk(KERNuINFO"Hello、world);
ログレベルが指定されていないprintk()で採用されているデフォルトのレベルはDEFAULT()です.MESSAGE_LOGLNEVELは、このマクロは、ケネル/printk.cで整数4と定義されています.即ち、KERN_に対応しています.WARNINGproc/sys/kersnel/printkでは、現在のコンソールログレベル、ログレベルが明確に指定されていないデフォルトメッセージログレベル、最小(最高)許可設定のコンソールログレベル、ブート時のデフォルトログレベルの4つの値が表示されます.printk()のメッセージログレベルが現在のコンソールログレベルより小さい場合、printkの情報がコンソール上に表示されます.しかし、現在の操作台のログレベルがどのような値であれ、/proc/kmsg(またはdmesgを使用する)を通じて常に確認されます.また、sylogdやklogdを設定して実行すると、コンソールに表示されていないprintkの情報も/var/logs/messages.logsに追加されます.コンソールのログレベルは読み書き/proc/sys/ケネル/printkファイルを読むことによって読み取られ、修正されます.このファイルを見る方法は以下の通りです. 4 1 7上に表示された4つのデータは、それぞれ、コンソールログレベル、デフォルトのメッセージログレベル、最低のコンソールログレベル、およびデフォルトのコンソールログレベルに対応します.