0

I need to make a few changes to the "Transaction service" section of a bunch of WebSphere application servers. I was hoping to script things using wsadmin.

One of the properties that I want to change is the "Transaction log directory". I tried to following tutorial:

The problem is that my recoveryLog object is always empty (with a Jython value of None) Is there another way to change this value?

Related to this question, are there properties that I can edit using the WAS web console that I can't edit using wsadmin? I would like to change a few more "deeply nested" properties and I want to make sure that I'm not wasting my time.

Tom Purl
  • 519
  • 4
  • 20

2 Answers2

1

I was able to change the log directory with the following commands:

serverEntryId = AdminConfig.getid("/ServerEntry:server1")
recoveryLog = AdminConfig.showAttribute(serverEntryId, "recoveryLog")
AdminConfig.modify(recoveryLog, '[[transactionLogDirectory c:/mylog]]')
AdminConfig.save()

Regarding your second question - everything what you can do via web console is doable via wsadmin scripting.

Gas
  • 17,601
  • 4
  • 46
  • 93
  • Thanks for the quick response Gas. Unfortunately, the "recoveryLog" object still has a value of None. What version of WAS are you using? I'm using 8.5.5.1. – Tom Purl Jun 06 '14 at 13:20
  • Do you get anything while calling: AdminConfig.showAttribute(serverEntryId, "recoveryLog") rl = AdminConfig.showAttribute(serverEntryId, "recoveryLog") print AdminConfig.show(rl) if not you may need to create recoveryLog entry using: AdminConfig.create(serverEntry, 'recoveryLog') I'm on 8.5.5.1 – Gas Jun 06 '14 at 17:32
  • I tried running that and got a NullPointerException. What do you mean when you ask if I've created a recoveryLog. Shouldn't it exist by default? – Tom Purl Jun 09 '14 at 20:15
  • 1
    No, it doesn't exists, if it has default settings. However once its create, in any subsequent changes you are only modifying it. I missed exact command to create that entry in last post, it should be like this: AdminConfig.create('RecoveryLog', serverEntry, '[[transactionLogDirectory "c:\mylog"]]') You can check the command in admin console via: 'Command Assistance - View administrative scripting command for last action' – Gas Jun 09 '14 at 23:31
  • Thanks a ton Gas. So basically I need to first create a recovery log and then specify the trans log directory as a property of that. – Tom Purl Jun 13 '14 at 19:51
0

Gas' answer is correct, assuming that you create the trans log first using the directions in his comments. I solved this problem a little differently though using the execellent WDR library. Here's how I did it:

mySeverEntry = listConfigObjects("ServerEntry", "*TomsServer*")[0]
mySeverEntry.create("RecoveryLog", 
        transactionLogDirectory="/some/dir1"), 
        compensationLogDirectory="/some/dir2"), 
        compensationLogFileSize="5") 
save()
sync()

I highly recommend the WDR library if you're looking for a more concise, pythonic way of scripting wsadmin changes.

Tom Purl
  • 519
  • 4
  • 20