rss
SOATUBE
Oracle
Custom Search SOABYTE here

Thursday, April 24, 2014

How to Stop WebLogic Server Scripting Tool (WLST) from Creating Zero-Byte Log Files

SYMPTOMS 
Zero bytes WLST logs are created under Middleware Home/logs directory, when the server is being shut down:
-rw-r----- 1 oracle dba 0 Nov 13 11:56 wlst_20111113115622.log
-rw-r----- 1 oracle dba 0 Nov 13 11:56 wlst_20111113115652.out
-rw-r----- 1 oracle dba 0 Nov 13 11:56 wlst_20111113115652.log
-rw-r----- 1 oracle dba 0 Nov 13 11:57 wlst_20111113115722.out
-rw-r----- 1 oracle dba 0 Nov 13 11:57 wlst_20111113115722.log

CAUSE
 From WebLogic Server 10.3.3, zero-byte log files are created in the logs directory whenever a WebLogic Server Scripting Tool (WLST) command is executed. This issue is caused by stopWeblogic.sh script, which uses WLST internally to shut down the running server:

echo "import os" >"shutdown.py" 
echo "if os.environ.has_key('wlsUserID'):" >>"shutdown.py" 
echo " wlsUserID = os.environ['wlsUserID']" >>"shutdown.py" 
echo "if os.environ.has_key('wlsPassword'):" >>"shutdown.py" 
echo " wlsPassword = os.environ['wlsPassword']" >>"shutdown.py" 
echo "connect(${userID} ${password} url='${ADMIN_URL}', adminServerName='${SERVER_NAME}')" >>"shutdown.py" 
echo "shutdown('${SERVER_NAME}','Server', ignoreSessions='true')" >>"shutdown.py" 
echo "exit()" >>"shutdown.py" 

SOLUTION 
There are straightforward ways either to workaround or to disable this feature.
 1.> By redirecting all log entries to a single file (thus eliminating multiple log files), use the following system property:
java -Dwlst.offline.log=/tmp/file.log weblogic.WLST
This will direct all WLST log entries to /tmp/file.log, rather than generating new log files each time that WLST is started.

 2.> By disabling WLST log entries entirely using the same system property:
java -Dwlst.offline.log=disable weblogic.WLST
This will suppress all WLST log entries and no log file will be created.

 3.> An Alternative solution is to edit the wlst.sh/.cd script, making sure that the WLST_PROPERTIES contains -Dwlst.offline.log=disable.

 (a) In the case of vanilla WebLogic Server installations, the $WL_HOME/common/bin/wlst.sh can be used as the template and the following line editted from
JVM_ARGS="-Dprod.props.file='${WL_HOME}'/.product.properties ${WLST_PROPERTIES} ${JVM_D64} ${MEM_ARGS} ${CONFIG_JVM_ARGS}"
to
JVM_ARGS="-Dwlst.offline.log=disable -Dprod.props.file='${WL_HOME}'/.product.properties ${WLST_PROPERTIES} ${JVM_D64} ${MEM_ARGS} ${CONFIG_JVM_ARGS}"

(b)For Fusion Middleware installations the template should be MWHOME/oracle_common/common/bin/wlst.sh and the edit is to change from
# Some scripts in WLST_HOME reference ORACLE_HOME
WLST_PROPERTIES="${WLST_PROPERTIES} -DORACLE_HOME='${ORACLE_HOME}' -DCOMMON_COMPONENTS_HOME='${COMMON_COMPONENTS_HOME}'"
to
# Some scripts in WLST_HOME reference ORACLE_HOME
WLST_PROPERTIES="${WLST_PROPERTIES} -Dwlst.offline.log=disable  -DORACLE_HOME='${ORACLE_HOME}'  -DCOMMON_COMPONENTS_HOME='${COMMON_COMPONENTS_HOME}'"

3 comments:

Anonymous said...

I implemented this but it doesn't actually disable the creation of log files, it just writes a file called disable and it's associated lock file in the current directory. Comments?

Nikitha said...

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well.

oracle fusion financials online training

megan collins said...

I wish to show thanks to you just for bailing me out of this particular trouble. As a result of checking through the net and meeting techniques that were not productive, Same as your blog I found another one Oracle Fusion Financials.Actually I was looking for the same information on internet for Oracle Fusion Financials and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

Post a Comment

 
Blogger Profile