Mercurial > hgrepos > hgweb.cgi > s4
changeset 798:91016ff5edb3 feature-world
Gather logs of all worlds into master logfile
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 14 Jun 2020 11:16:41 +0900 |
parents | 56adb6e5ee68 |
children | e516626923f7 |
files | s4-funcs.sh |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-funcs.sh Sun Jun 14 11:15:45 2020 +0900 +++ b/s4-funcs.sh Sun Jun 14 11:16:41 2020 +0900 @@ -28,9 +28,10 @@ PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH tmpdir=${TMPDIR:-tmp} dbdir=${DBDIR:-db} +logdir=${LOGDIR:-tmp} tmpfiles="" -querylog=${QUERYLOG:-$tmpdir/query.log} -searchlog=${SEARCHLOG:-$tmpdir/search.log} +querylog=${QUERYLOG:-$logdir/query.log} +searchlog=${SEARCHLOG:-$logdir/search.log} db=${DB:-$dbdir/cgi.sq3} sessdb=${SESSDB:-$dbdir/sess.sq3} userupdateflag=$dbdir/userupdate @@ -84,9 +85,10 @@ iconcachekey="profimgcache_S" # Start debug logging -exec 3>> $tmpdir/debug.out +logtag="${S4WORLD:+\{$S4WORLD\}}" +exec 3>> $logdir/debug.out err() { - echo "[`date +%F-%T%z`] $@" 1>&3 + echo "[`date +%F-%T%z`]$logtag $@" 1>&3 } case "$HTTP_USER_AGENT" in *i[Pp]hone*|*[Aa]ndroid*) touchpanel=1 ;; @@ -97,7 +99,7 @@ ### if [ -n "$S4MASTERDB" -a -s "$S4MASTERDB" ]; then # If S4WORLDLIST is set, this s4 have world! if [ -n "$S4WORLDLIST" ]; then - . ./s4-world.sh 2>> tmp/debug.out + . ./s4-world.sh 2>> $logdir/debug.out # Variables set in s4-world.sh # $S4WORLDS, $S4WROLDNAME, $S4WORLDGRPS # Files created in s4-world.sh @@ -372,10 +374,10 @@ EOF logstart() { - echo "`date '+%F %T'`:[${user:-NULL}] <<<" >> ${1:-$querylog} + echo "`date '+%F %T'`:[${user:-NULL}]$logtag <<<" >> ${1:-$querylog} } logend() { - echo ">>>" >> ${1:-$querylog} + echo ">>>$logtag" >> ${1:-$querylog} } sqlog() { logstart @@ -410,10 +412,10 @@ sq $db < $sqi & sq3pid="`jobs -p` $!" if $isCGI; then - exec 2>> $tmpdir/error.out + exec 2>> $logdir/error.out fi exec 5> $sqi # Turning $sqi access through fd5 for continuous open state - chmod o-r $tmpdir/error.out $tmpdir/debug.out + chmod o-r $logdir/error.out $logdir/debug.out rm $sqi # Attach supplemental DB cat >&5 <<-EOF