This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Portageのログ
When using emerge for building a package, it is not uncommon to notice messages coming from Portage itself. Since they may contain important information from Gentoo developers it is a good idea to read them, but often this is not immediately possible because they rapidly scroll out of the screen. This can be easily solved by enabling a Portage feature called elog, whose purpose is to save messages to disk for later review. But other logging capabilities exist as well...
Portage elog サブシステム
Portage elog サブシステムは、管理者またはユーザーの注意を引き付けるために ebuild に開発者が入れた特定の、ebuild が生成したログメッセージを追跡します。 これらのメッセージにはパッケージのビルドに関連した情報が含まれ、それはしばしば重要だったり関心をもつべきものだったりします。
セットアップ
PORTAGE_ELOG_CLASSES
変数を介してログに記録する情報の種類を選択。 可能な値は、info
, warn
, error
, log
and qa
:
PORTAGE_ELOG_CLASSES="log warn error"
ファイルへの保存の設定
Portageは、多くの方法で elog イベントを処理することができます。
ディスクに elog のイベントを保存するためには、PORTAGE_ELOG_SYSTEM
変数の save
モジュールを有効:
/etc/portage/make.conf
PORTAGE_ELOG_SYSTEM="save"
メッセージは、/var/log/portage/elog または${PORT_LOGDIR}/elog 変数が設定されている場合に保存されます。
カテゴリ毎に elog ファイルを作成するには、Portage のsplit-elog
機能を有効にします。 これは、/var/log/portage/elog という場所にカテゴリベースのサブディレクトリを作成することを、Portageに強制します。
電子メール機能を設定
ログをメール送信するために、mail
モジュール有効化。 メールオプションは、いくつかの追加の変数を設定することが必要です。 詳細については、/usr/share/portage/config/make.conf.exampleをお読みください。
以下のセットアップ例がわかりやすいでしょう:
/etc/portage/make.conf
PORTAGE_ELOG_SYSTEM="mail" # 送信先アドレスと、SMTP サーバ名 PORTAGE_ELOG_MAILURI="log-intake@example.com mail.example.com" PORTAGE_ELOG_MAILFROM="portage@$(hostname).example.com" PORTAGE_ELOG_MAILSUBJECT="${PACKAGE} is ${ACTION} on ${HOST}"
nullmailerやsendmailを使う例もあります:
/etc/portage/make.conf
PORTAGE_ELOG_SYSTEM="mail" # First the mail-to address, then the SMTP server PORTAGE_ELOG_MAILURI="users@host /usr/sbin/sendmail" PORTAGE_ELOG_MAILFROM="portage@$(hostname).example.com" PORTAGE_ELOG_MAILSUBJECT="${PACKAGE} is ${ACTION} on ${HOST}"
関連するソフトウェア
以下は、elog 関連のソフトウェアパッケージの一覧です。
- app-portage/elogv - Curses based utility to parse the contents of elogs
- app-portage/elogviewer - Python based elog viewer
ログを構築
失敗や成功に関係なく、Portage elogサブシステムと、パッケージのビルドログはディスク上に保存されているか、リモート受信者に郵送します。 管理者が確認するためにこれは後のビルドまたはサポートチケットのビルドログを取得できます。
セットアップ
To enable Portage logging, edit /etc/portage/make.conf and set PORT_LOGDIR to a location where the log files should be stored. By default, Portage will use /var/log/portage:
/etc/portage/make.conf
PORT_LOGDIR="/var/log/portage"
次に、多くの FEATURES
設定は、Portageが構築するログがどのように処理されるのかに影響します。
- With
binpkg-logs
set, even binary package deployments will have their logs saved - When
clean-logs
is set, regular log file clean operations are executed. The command that is executed is defined byPORT_LOGDIR_CLEAN
and defaults to a retention of the files of 7 days. - With
split-log
set, build logs are stored in category-named subdirectories of${PORT_LOGDIR}/build
binpkg-logs
設定もバイナリパッケージの導入は、それらのログが保存されているでしょうclean-logs
が設定されている場合、通常のログファイルのクリーン操作が実行されます。 実行するコマンドは以下のように定義されPORT_LOGDIR_CLEAN
デフォルトは7日のファイルの保持。split-log
セット、ログを構築するには、カテゴリの名前のサブディレクトリに格納され${PORT_LOGDIR}/build
Cleaning up
When clean-logs
is set, Portage will execute the command defined by PORT_LOGDIR_CLEAN after every build or unmerge operation. By default, the following command is used:
/usr/share/portage/config/make.globals
PORT_LOGDIR_CLEAN="find \"\${PORT_LOGDIR}\" -type f ! -name \"summary.log*\" -mtime +7 -delete"
When defining a custom command, do not forget to escape the PORT_LOGDIR variable (or immediately hardcode the right location).