Skip to content

Commit

Permalink
[minor] Don't use savelog to rotate log files
Browse files Browse the repository at this point in the history
Save log into ${LOG_PATH}/mkiso.log.$(date +%Y%m%d%H%M%S) to simplfy
log parser.
  • Loading branch information
StephenPCG committed Nov 4, 2011
1 parent 8477e4e commit 7222bed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common
Expand Up @@ -9,7 +9,7 @@
exit_fail ()
{
if [ "$ALL_DONE" == "true" ]; then exit 0; fi
echo_and_log "[ERROR] The building process failed, see log file for more details: ${LOG_FILE}.0"
echo_and_log "[ERROR] The building process failed, see log file for more details: ${LOG_FILE}"
clean_up
exit 1
}
Expand Down
11 changes: 7 additions & 4 deletions mkiso
Expand Up @@ -20,7 +20,6 @@ clean_up ()
{
[[ -f "${CHROOT_LOCK}" ]] && postchroot
[[ -f "${BUILD_LOCK}" ]] && rm ${BUILD_LOCK}
savelog -q ${LOG_FILE}
}

do_help ()
Expand Down Expand Up @@ -130,9 +129,14 @@ script_init ()

APT_ARCHIVE_PATH="${APT_ARCHIVE_BASE}/${VERSION}/${ARCH}"

## Don't use savelog to rotate log, instead, save all logs,
## postfix with the log start time
LOG_PATH="${LOG_BASE}/${VERSION}/${SCHEME}/${ARCH}"
LOG_FILE="${LOG_PATH}/${SCRIPT_NAME}.log"
LOG_TIME="$(date +%Y%m%d%H%M%S)"
LOG_FILE="${LOG_PATH}/${SCRIPT_NAME}.log.${LOG_TIME}"
[[ -d "${LOG_PATH}" ]] || mkdir -p ${LOG_PATH}
## mkiso.log points to the latest log
ln -sf ${SCRIPT_NAME}.log.${LOG_TIME} ${LOG_PATH}/${SCRIPT_NAME}.log

BUILD_LOCK="/tmp/${SCRIPT_NAME}-${VERSION}-${SCHEME}-${ARCH}.lock"
CHROOT_LOCK="/tmp/${SCRIPT_NAME}-${VERSION}-${SCHEME}-${ARCH}-chroot.lock"
Expand Down Expand Up @@ -495,9 +499,8 @@ lockfile ${BUILD_LOCK}
do_action ${ACTIONS}

echo_and_log "[MKISO] Finished executing actions: ${ACTIONS}"
echo_and_log "[MKISO] See log for more details: ${LOG_FILE}.0"
echo_and_log "[MKISO] See log for more details: ${LOG_FILE}"

rm -f ${BUILD_LOCK}
clean_up

export ALL_DONE="true"
Expand Down

0 comments on commit 7222bed

Please sign in to comment.