Pages

Wednesday, April 8, 2015

Change Weblogic AdminServer.log, access.log and domain.log configuration using WLST script

Step1:  create a python script simple txt editor using below script, if we have more number of WLS instance then add more lines similar to below lines for each WLS instance and run the script


username ="'weblogic"
password = "xxxxx"
URL='t3://hostname.domain.com.au:7001'
connect(username,password,URL)
print "Connected successfully with Admin Server"



edit()
startEdit()










print "Domain log configuration change started"
cd('/Log/domain')
cmo.setLogFileRotationDir('/u01/app/oracle/admin/domain/cluster/logs/domain/archive')
cmo.setFileName('/u01/app/oracle/admin/domain/cluster/logs/domain/domain.log')
cmo.setRotationType('byTime')
cmo.setFileCount(30)
cmo.setRotateLogOnStartup(true)
cmo.setNumberOfFilesLimited(true)
print "Domain log configuration change end"


print "Admin server log change started"
#print '\t\t==================='+AdminServer Log Configuration Change Started +'===================='
cd('/Servers/AdminServer/Log/AdminServer')
cmo.setLogFileRotationDir('/u01/app/oracle/admin/domain/cluster/logs/AdminServer/archive')
cmo.setRotationType('byTime')
cmo.setFileCount(30)
cmo.setFileName('/u01/app/oracle/admin/domain/cluster/logs/AdminServer/AdminServer.log')
cmo.setRotateLogOnStartup(true)
cmo.setNumberOfFilesLimited(true)

cd('/Servers/AdminServer/WebServer/AdminServer/WebServerLog/AdminServer')
cmo.setRotationType('byTime')
cmo.setFileCount(30)
cmo.setFileName('/u01/app/oracle/admin/domain/cluster/logs/AdminServer/access.log')
cmo.setLogFileRotationDir('/u01/app/oracle/admin/domain/cluster/logs/AdminServer/archive')
cmo.setRotateLogOnStartup(true)
cmo.setNumberOfFilesLimited(true)

cd('/Servers/AdminServer/DataSource/AdminServer/DataSourceLogFile/AdminServer')
cmo.setLogFileRotationDir('/u01/app/oracle/admin/domain/cluster/logs/AdminServer/archive')
cmo.setRotationType('byTime')
cmo.setFileCount(30)
cmo.setFileName('/u01/app/oracle/admin/domain/cluster/logs/AdminServer/datasource.log')
cmo.setRotateLogOnStartup(true)
cmo.setNumberOfFilesLimited(true)
print "Admin server log change finished"


print "WLS_BAM1 log change Started"
cd('/Servers/WLS_BAM1/Log/WLS_BAM1')
cmo.setLogFileRotationDir('/u01/app/oracle/admin/domain/cluster/logs/WLS_BAM1/archive')
cmo.setRotationType('byTime')
cmo.setFileCount(30)
cmo.setFileName('/u01/app/oracle/admin/domain/cluster/logs/WLS_BAM1/WLS_BAM1.log')
cmo.setRotateLogOnStartup(true)
cmo.setNumberOfFilesLimited(true)

cd('/Servers/WLS_BAM1/WebServer/WLS_BAM1/WebServerLog/WLS_BAM1')
cmo.setLogFileRotationDir('/u01/app/oracle/admin/domain/cluster/logs/WLS_BAM1/archive')
cmo.setRotationType('byTime')
cmo.setFileCount(30)
cmo.setFileName('/u01/app/oracle/admin/domain/cluster/logs/WLS_BAM1/access.log')
cmo.setRotateLogOnStartup(true)
cmo.setNumberOfFilesLimited(true)

cd('/Servers/WLS_BAM1/DataSource/WLS_BAM1/DataSourceLogFile/WLS_BAM1')
cmo.setLogFileRotationDir('/u01/app/oracle/admin/domain/cluster/logs/WLS_BAM1/archive')
cmo.setRotationType('byTime')
cmo.setFileCount(30)
cmo.setFileName('/u01/app/oracle/admin/domain/cluster/logs/WLS_BAM1/datasource.log')
cmo.setRotateLogOnStartup(true)
cmo.setNumberOfFilesLimited(true)
print "WLS_BAM1 log change Finished"
activate()

Step2:  

Run the script using wlst.sh located inside WL_HOME
/u01/app/oracle/product/fmw/wlserver_10.3/common/bin/wlst.sh /scripts/changLogConfiguration/ChangeServerStartParameter_PreEnv.py

No comments:

Post a Comment