cinqict

Wednesday, April 3, 2013

weblogic custom log directory

In order to move the default log directory to a custom location, I have created the following piece of script. This can be inserted into the $DOMAIN_HOME/startWeblogic.sh script, under #START WEBLOGIC.

In the example I will place the custom log directory in /w001/logs/${DOMAIN_NAME}/serverlogs/${SERVER_NAME}



if [ -d ${DOMAIN_HOME}/servers/${SERVER_NAME} ] && [ ! -L ${DOMAIN_HOME}/servers/${SERVER_NAME}/logs ] ; then
DOMAIN_NAME=`echo ${DOMAIN_HOME} | awk -F/ '{ print $NF }'`
mkdir -p /w001/logs/${DOMAIN_NAME}/serverlogs/${SERVER_NAME}
mv ${DOMAIN_HOME}/servers/${SERVER_NAME}/logs ${DOMAIN_HOME}/servers/${SERVER_NAME}/logs.old && ln -s /w001/logs/${DOMAIN_NAME}/serverlogs/${SERVER_NAME} ${DOMAIN_HOME}/servers/${SERVER_NAME}/logs
fi


The existing log directory is moved to a logs.old directory, so you can copy these logs at a later time.

No comments:

Post a Comment