Omaha #4148 Changes to script to use fewer env variables and update logback files.
Change-Id: I8b5b82c4ee371ab10c571a6075c71143bb9e0100 Former-commit-id: 20c1d6c1851012b49f18d43aa6203e4dc51cbd72
This commit is contained in:
parent
39b33b12a9
commit
9eebfd0c0e
5 changed files with 43 additions and 77 deletions
|
@ -26,6 +26,7 @@
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# Oct 09, 2014 #3675 bclement added cleanExit signal trap
|
||||
# Jun 17, 2015 #4148 rferrel Logback needs fewer environment variables.
|
||||
#
|
||||
|
||||
user=`/usr/bin/whoami`
|
||||
|
@ -96,7 +97,7 @@ fi
|
|||
|
||||
#check for the logs directory, which may not be present at first start
|
||||
hostName=`hostname -s`
|
||||
LOGDIR=$HOME/caveData/logs/consoleLogs/$hostName/
|
||||
export LOGDIR=$HOME/caveData/logs/consoleLogs/$hostName/
|
||||
|
||||
if [ ! -d $LOGDIR ]; then
|
||||
mkdir -p $LOGDIR
|
||||
|
@ -122,27 +123,17 @@ trap 'cleanExit $pid' SIGHUP SIGINT SIGQUIT SIGTERM
|
|||
count=0
|
||||
while [ $exitVal -ne 0 -a $count -lt 10 ]
|
||||
do
|
||||
count=`expr $count + 1`
|
||||
curTime=`date +%Y%m%d_%H%M%S`
|
||||
LOGFILE=${LOGDIR}/alertviz_${curTime}_console.log
|
||||
export LOGFILE_ALERTVIZ=${LOGDIR}/alertviz_${curTime}_admin.log
|
||||
|
||||
#first check if we can write to the directory
|
||||
if [ -w ${LOGDIR} ]; then
|
||||
touch ${LOGFILE}
|
||||
fi
|
||||
|
||||
#check for display; if no display then exit
|
||||
if [ -z "${DISPLAY}" ]; then
|
||||
echo "Display is not available."
|
||||
exitVal=0
|
||||
else
|
||||
#finally check if we can write to the file
|
||||
if [ -w ${LOGFILE} ]; then
|
||||
${dir}/alertviz $* > ${LOGFILE} 2>&1 &
|
||||
count=`expr $count + 1`
|
||||
#check for display; if no display then exit
|
||||
if [ -z "${DISPLAY}" ]; then
|
||||
echo "Display is not available."
|
||||
exitVal=0
|
||||
else
|
||||
${dir}/alertviz $* &
|
||||
fi
|
||||
if [ -w ${LOGDIR} ] ; then
|
||||
${dir}/alertviz $* > /dev/null 2>&1 &
|
||||
else
|
||||
${dir}/alertviz $* &
|
||||
fi
|
||||
pid=$!
|
||||
wait $pid
|
||||
exitVal=$?
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
# Oct 10, 2014 #3675 njensen Logback now does console logging to ensure correct pid
|
||||
# Oct 13, 2014 #3675 bclement startup shutdown log includes both launching pid and placeholder
|
||||
# Jan 28, 2015 #4018 randerso Added a productEditor log file to changes in the GFE product editor
|
||||
# Jun 17, 2015 #4148 rferrel Logback needs fewer environment variables.
|
||||
#
|
||||
|
||||
|
||||
|
@ -194,7 +195,7 @@ then
|
|||
fi
|
||||
|
||||
BASE_LOGDIR=$HOME/caveData/logs/consoleLogs
|
||||
LOGDIR=$BASE_LOGDIR/$hostName/
|
||||
export LOGDIR=$BASE_LOGDIR/$hostName/
|
||||
|
||||
# make sure directory exists
|
||||
if [ ! -d $LOGDIR ]; then
|
||||
|
@ -212,13 +213,6 @@ export LOGFILE_STARTUP_SHUTDOWN="${LOGDIR}/${PROGRAM_NAME}_${pid}_${curTime}_pid
|
|||
# At this point fork so that log files can be set up with the process pid and
|
||||
# this process can log the exit status of cave.
|
||||
(
|
||||
# we include the PID of the launching process along with
|
||||
# a %PID% placeholder to be replaced with the "real" PID
|
||||
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_logs.log"
|
||||
export LOGFILE_CONSOLE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_console.log"
|
||||
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_perf.log"
|
||||
export LOGFILE_PRODUCT_EDITOR="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_productEditor.log"
|
||||
|
||||
# can we write to log directory
|
||||
if [ -w ${LOGDIR} ]; then
|
||||
touch ${LOGFILE_STARTUP_SHUTDOWN}
|
||||
|
|
|
@ -25,27 +25,15 @@ SET JavaJreDirectory=
|
|||
|
||||
REM Determine where we will be logging to.
|
||||
SET HOME_DIRECTORY=%USERPROFILE%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOME_DIRECTORY%\caveData\logs
|
||||
SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME%
|
||||
IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%")
|
||||
|
||||
REM Use by logback configuration files to determine console and admin
|
||||
SET LOGDIR=%HOME_DIRECTORY%\caveData\logs
|
||||
|
||||
echo Starting ALERTVIZ; leave this CMD window open to enable AlertViz 'restart'.
|
||||
REM Start AlertViz (and implement the alertviz restart capability).
|
||||
:AlertVizLoopStart
|
||||
SET RND=%random%
|
||||
SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp
|
||||
REM Python is used to retrieve the current date and time because the order
|
||||
REM of the Windows date/time fields is not necessarily guaranteed and the
|
||||
REM Windows date/time fields can only be extracted using substring operations
|
||||
REM instead of -formatter- strings like Linux allows.
|
||||
python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
|
||||
SET /p LOG_DATETIME= < %RND_DATETIME_FILE%
|
||||
DEL %RND_DATETIME_FILE%
|
||||
|
||||
SET LOGFILE_CONSOLE=%CAVEDATA_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%_console.log
|
||||
SET LOGFILE_ALERTVIZ=%CAVEDATA_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%_admin.log
|
||||
|
||||
"%CONTAINING_DIRECTORY%alertviz.exe" %* > "%CONSOLE_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%.log" 2>&1
|
||||
"%CONTAINING_DIRECTORY%alertviz.exe" %*
|
||||
IF %ERRORLEVEL% == 0 (EXIT)
|
||||
echo Restarting AlertViz.
|
||||
GOTO AlertVizLoopStart
|
||||
|
|
|
@ -28,29 +28,14 @@ SET JavaJreDirectory=
|
|||
|
||||
REM Determine where we will be logging to.
|
||||
SET HOME_DIRECTORY=%USERPROFILE%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOME_DIRECTORY%\caveData\logs
|
||||
SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME%
|
||||
IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%")
|
||||
|
||||
SET RND=%random%
|
||||
SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp
|
||||
REM Python is used to retrieve the current date and time because the order
|
||||
REM of the Windows date/time fields is not necessarily guaranteed and the
|
||||
REM Windows date/time fields can only be extracted using substring operations
|
||||
REM instead of -formatter- strings like Linux allows.
|
||||
python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
|
||||
SET /p LOG_DATETIME= < %RND_DATETIME_FILE%
|
||||
DEL %RND_DATETIME_FILE%
|
||||
|
||||
SET LOGFILE_CAVE=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_logs.log
|
||||
SET LOGFILE_CONSOLE=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_console.log
|
||||
SET LOGFILE_PERFORMANCE=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_perf.log
|
||||
SET LOGFILE_PRODUCT_EDITOR=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_productEditor.log
|
||||
REM Used by logback configuration files to determine console and admin
|
||||
SET LOGDIR=%HOME_DIRECTORY%\caveData\logs
|
||||
|
||||
echo THIS CMD WINDOW CAN BE CLOSED AT ANY TIME!
|
||||
cd %HOMEPATH%
|
||||
REM Start CAVE.
|
||||
"%CONTAINING_DIRECTORY%cave.exe" %* > "%CONSOLE_LOG_DIRECTORY%\cave_%LOG_DATETIME%.log" 2>&1
|
||||
"%CONTAINING_DIRECTORY%cave.exe" %*
|
||||
IF ERRORLEVEL 1 (echo CAVE ERROR - check the logs for additional information. && PAUSE)
|
||||
|
||||
EXIT
|
||||
|
|
|
@ -2,9 +2,20 @@
|
|||
<!-- Only define when not wanting to use the UF Standard.
|
||||
<property scope="context" name="log.message.pattern" value="%-5p %d [%t] %c{0}: %m%n"/>
|
||||
-->
|
||||
<timestamp key="startTime" datePattern="yyyyMMdd_HHmmss" />
|
||||
<define name="adminLogFile" class="com.raytheon.uf.common.logback.LogFilePropertyDefiner" >
|
||||
<directory>${LOGDIR}</directory>
|
||||
<name>alertviz_${startTime}_admin.log</name>
|
||||
</define>
|
||||
<define name="consoleLogFile" class="com.raytheon.uf.common.logback.LogFilePropertyDefiner" >
|
||||
<directory>${LOGDIR}</directory>
|
||||
<name>alertviz_${startTime}_console.log</name>
|
||||
</define>
|
||||
|
||||
<!-- general application log -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="com.raytheon.uf.common.logback.encoder.UFStdEncoder"/>
|
||||
<!-- In eclipse InvertedThresholdFilter allows different color display for console and errConsole. -->
|
||||
<filter class="com.raytheon.uf.common.logback.filter.InvertedThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
|
@ -18,20 +29,16 @@
|
|||
<encoder class="com.raytheon.uf.common.logback.encoder.UFStdEncoder"/>
|
||||
</appender>
|
||||
|
||||
<appender name="AlertVizAdminLogAppender" class="com.raytheon.uf.common.logback.appender.EnvConfigurableRollingFileAppender">
|
||||
<!-- file and fileNamePattern will be overridden by the env variable if present, but are required by logback -->
|
||||
<file>alertviz-admin.log</file>
|
||||
<envLogVar>LOGFILE_ALERTVIZ</envLogVar>
|
||||
<rollingPolicy class="com.raytheon.uf.common.logback.policy.EnvConfigurableFixedWindowRollingPolicy">
|
||||
<fileNamePattern>alertviz-admin.log%i</fileNamePattern>
|
||||
<envLogVar>LOGFILE_ALERTVIZ</envLogVar>
|
||||
<minIndex>1</minIndex>
|
||||
<maxIndex>5</maxIndex>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<maxFileSize>2GB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
<append>true</append>
|
||||
<appender name="consoleLog" class="com.raytheon.uf.common.logback.appender.ConsoleFileAppender">
|
||||
<encoder class="com.raytheon.uf.common.logback.encoder.UFStdEncoder"/>
|
||||
<file>${consoleLogFile}</file>
|
||||
<filter class="com.raytheon.uf.common.logback.filter.InvertedThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="AlertVizAdminLogAppender" class="ch.qos.logback.core.FileAppender">
|
||||
<file>${adminLogFile}</file>
|
||||
<encoder class="com.raytheon.uf.common.logback.encoder.UFStdEncoder"/>
|
||||
</appender>
|
||||
|
||||
|
@ -71,5 +78,6 @@
|
|||
<level value="INFO"/>
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="errConsole"/>
|
||||
<appender-ref ref="consoleLog"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
Loading…
Add table
Reference in a new issue