Portage log/ko

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Portage log and the translation is 11% complete.
Outdated translations are marked like this.
Other languages:

The Portage log provides information when installing, updating, or removing packages.

emerge를 사용하여 꾸러미를 빌드할 때, 포티지에서 보통 잘 나오지 않는 알림 메시지가 뜹니다. 젠투 개발자들이 알려주는 중요한 정보가 있을지 모르기 때문에 읽어보시는 것이 좋지만, 화면 위로 너무 빨리 넘어가기 때문에 보통 불가능합니다. elog라고 하는 포티지 기능을 활성화하면 이 문제를 해결할 수 있는데, 나중에 다시 살펴볼 로그를 디스크에 저장하는 동작이 이 기능의 목적입니다. 그러나 마찬가지로 다른 로깅 기능도 있습니다...

포티지 elog 하위 시스템은 관리자 또는 사용자에게 주의를 끌도록 개발자가 ebuild에 넣어, 개별 ebuild에서 제공하는 로그 메시지 내용을 유지합니다. 종종 이 메시지는 언급한 꾸러미 빌드에 관련있는 중요한 관심있는 정보가 들어있습니다.

설정

PORTAGE_ELOG_CLASSES 변수에 어떤 종류의 정보를 기록할 지 선택하십시오. 가능한 값은 info, warn, error, log, qa 입니다:

파일 /etc/portage/make.conf
PORTAGE_ELOG_CLASSES="log warn error"

파일 기반 저장소 설정

포티지는 여러가지 방법으로 elog 이벤트를 처리할 수 있습니다.

elog 이벤트 기록을 디스크에 저장하려면 PORTAGE_ELOG_SYSTEM 변수에 save 모듈을 넣어 활성화하십시오:

파일 /etc/portage/make.conf
PORTAGE_ELOG_SYSTEM="save"
  1. Show messages after emerging *and* save

PORTAGE_ELOG_SYSTEM="echo save" }}

메시지는 /var/log/portage/elog에 저장하든지 언급한 변수를 설정했다면 ${PORT_LOGDIR}/elog에 저장합니다.

카테고리별 elog 파일을 만들려면 split-elog 포티지 기능을 활성화하십시오. 포티지가 /var/log/portage/elog 위치에 카테고리 기반 디렉터리를 만들도록 강제 설정합니다.

Additionally, to create per-category build logs, enable the split-log Portage feature. It will force Portage to create category-based subdirectories of the /var/log/portage/build location.

Script to lookup logs

When the logs are split up, it's a bit annoying to look through them one by one. Here's an example script to print them using the date:

파일 print-elog-messages.sh
#!/bin/bash
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# This script is assuming that portage is configured to log in
# /var/log/portage/elog and that it's configured to split the logged files.
#
# If you want specific dates, run the script like so:
# GET_DATES="20230101 20230102" ./print_elog_messages.sh
#
# If you want all files to be printed, run the script like so:
# GET_ALL="true" ./print_elog_messages.sh
#
# If the script filename is different, adjust accordingly!
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Check if running as root and stop if it is.
current_user=$(whoami)
[ -z "$current_user" ] && echo "whoami returns an empty string" && exit 1
[ "$current_user" == "root" ] && echo "Don't run as root, there's no need!" && exit 1
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Set periods to check. These strings are interpreted by the "date" tool.
declare -a days=("today" "yesterday")
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Change the array to the custom dates if they're declared.
[ -n "$GET_DATES" ] && declare -a days=("$GET_DATES")
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# If we're printing everything, there's no reason to loop multiple times and
# it would make sense to change the period to "all".
[ "$GET_ALL" == "true" ] && declare -a days=("all")
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Go through the periods set in the array "days" and format to find filenames
# containing YYYYmmdd, for example 20221215, since that's the format that's
# part of the filenames by default. After this, run the command cat with the
# found filenames as arguments, which adds the file contents
# to the terminal output. Remove the -n argument from cat if you don't want
# it to print the line numbers as well.
for val in ${days[@]}; do
	echo "          ===== $val ====="
	find /var/log/portage/elog -name \
		"*$([ "$GET_ALL" == "true" ] || date --date=$val +%Y%m%d)*" \
		-type f -print -exec cat -n '{}' \;
done

전자메일 설정

수신자에게 로그를 메일로 보내려면 mail 모듈을 활성화하십시오. 메일 옵션은 몇가지 추가 변수를 설정해야합니다. 자세한 내용은 /usr/share/portage/config/make.conf.example 파일을 살펴보십시오.

아래, 자체적으로 설명한 예제 설정이 있습니다:

파일 /etc/portage/make.conf
PORTAGE_ELOG_SYSTEM="mail"
# First the mail-to address, then the SMTP server
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 관련 프로그램 꾸러미 목록입니다:

빌드 기록

포티지 elog 하위시스템에서, 꾸러미 빌드 로그는 실패/성공 여부 관계없이 디스크에 저장하거나 원격 수신자에게 메일로 보냅니다. 이 기능은 관리자가 나중에 다시 살펴보거나 티켓을 지원하는 시스템에 빌드 로그를 보냅니다.

By default, when emerge is running, Portage temporarily saves the build log of a package to /var/tmp/portage/<category>/<packagename-version>/temp/build.log. The build directory will be deleted when emerge finishes successfully, so successful build logs will be lost. If a build fails however, the logs will be retained, so the build.log will still be available for attaching to support tickets.

n.b. The build.log may be followed by an extra extension if compress-build-logs is set in FEATURES. The default PORTAGE_TMPDIR is /var/tmp, adjust path accordingly if it is set to something different in make.conf.

설정

포티지 기록을 활성화하려면, /etc/portage/make.conf를 편집하여 PORT_LOGDIR 변수에 로그 파일 저장 위치를 설정하십시오. 기본적으로 포티지는 /var/log/portage 경로를 사용합니다:

파일 /etc/portage/make.conf
PORT_LOGDIR="/var/log/portage"

It is customary to choose /var/log/portage as the location for log files, because it is where the elog subsystem's elog directory would be if PORTAGE_LOGDIR has been previously empty or unset.

다음, 빌드 로그를 포티지에서 다루는 방법을 처리하는 몇가지 FEATURES 설정을 넣으십시오.

  • binpkg-logs 값을 설정하면, 바이너리 꾸러미 배포시에도 로그를 저장합니다
  • clean-logs 값을 설정하면, 일반 로그 파일을 지웁니다. 실행할 명령은 PORT_LOGDIR_CLEAN에 정의하며 파일 기본 유지 기간은 7일입니다.
  • split-log 값을 설정하면, 카테고리 이름을 지정한${PORT_LOGDIR}/build의 하위 디렉터리에 빌드 로그를 저장합니다.

Until Portage version 2.3.53, PORTAGE_LOGDIR variable used to be named PORT_LOGDIR. This old name is now deprecated.

지우기

clean-logs를 설정하면 포티지는 빌드 또는 언머지 처리 과정 이후 PORT_LOGDIR_CLEAN 에 설정한 명령을 실행합니다. 기본적으로 다음 명령을 사용합니다:

파일 /usr/share/portage/config/make.globals
PORT_LOGDIR_CLEAN="find \"\${PORT_LOGDIR}\" -type f ! -name \"summary.log*\" -mtime +7 -delete"

개별 명령어를 설정할 때 ${PORT_LOGDIR} 변수에 이스케이핑(또는 올바른 위치를 직접 입력)을 잊지 마십시오.

Until Portage version 2.3.53, PORTAGE_LOGDIR_CLEAN variable used to be named PORT_LOGDIR_CLEAN. This old name is now deprecated.

Other Portage log files

Portage also can have log files in /var/log/emerge.log, and /var/log/emerge-fetch.log.

See also

  • Elogv — a curses-based tool that parses the contents of elogs created by Portage.

외부 자료