2008-07-30

Changing server log level with WLST

When an application goes to production, the application server, on which the application is deployed, has to be tuned to accept a bigger load.

One of the basic optimization is to limit the I/O, by, for instance, reducing the amount of information logged.

This is quite easy when you have one or two servers but can rapidly become a repeatiting and annoying task when this number goes up to 5, and more.

That's why I'm providing a simple routine whose goal is to perform a sample log level adjustement for any server in the domain.

Here we go :

// Loading properties from a file located at the same location as the script
loadProperties('config.properties');

// Connecting to the administration server using the three values (USER, PASSWORD & URL) defined in the property file
connect (USER,PASSWORD,URL)

edit()
startEdit()

servers = cmo.getServers()
for server in servers :
cd('/Servers/' + server.getName() + '/Log/' + server.getName())
cmo.setFileName(HOME + '/logs/' + server.getName())
cmo.setFileMinSize(5000)
cmo.setRotateLogOnStartup(true)
cmo.setDomainLogBroadcastSeverity('Off')
cmo.setMemoryBufferSeverity('Off')
cmo.setLogFileSeverity('Info')
cmo.setStdoutSeverity('Off')

activate()
exit()
 



Of course, this is only an example you can use, to start with.




Feel free to write your own options or preferences.

No comments: