Question & Answer
Question
How can I generate wsadmin script to change the log file locations for the following log files?
(1) SystemOut.log
(2) SystemErr.log
(3) native_stdout.log and native_stderr.log
(4) activity.log
(5) trace.log
(2) SystemErr.log
(3) native_stdout.log and native_stderr.log
(4) activity.log
(5) trace.log
Answer
Before you begin:
For troubleshooting, IBM Support Center can ask you to run the collector tool that gathers the information about your WAS environment including the log files.
[Gathering information with the collector tool]
https://www.ibm.com/docs/was-nd/9.0.5?topic=tools-gathering-information-collector-tool
For troubleshooting, IBM Support Center can ask you to run the collector tool that gathers the information about your WAS environment including the log files.
[Gathering information with the collector tool]
https://www.ibm.com/docs/was-nd/9.0.5?topic=tools-gathering-information-collector-tool
This tool does not collect the files outside of WAS installation directory. So, please make sure new appropriate log location before changing it.
Steps:
- Please start the wsadmin script using jython:
- [UNIX/Linux]
./wsadmin.sh -lang jython
[Windows]wsadmin.bat -lang jython
- [UNIX/Linux]
- These sample commands are for the Application Server as cell=Cell01, node=Node01, server=server1. Please replace them with your JVM that you need to modify.
- You can get the list of cellname, nodename, and servername using the following command after login via wsadmin.
wsadmin>print AdminConfig.list('Server')
For example, here is the sample output of dmgr:
dmgr(cells/Cell01/nodes/Manager01/servers/dmgr|server.xml#Server_1)
You can see cell=Cell01, node=Manager01, server=dmgr
- You can get the list of cellname, nodename, and servername using the following command after login via wsadmin.
(1) SystemOut.log
----------------------------------
1. First, you need to get the configID for JVM you want to modify
----------------------------------
1. First, you need to get the configID for JVM you want to modify
>serverID=AdminConfig.getid('/Cell:Cell01/Node:Node01/Server:server1/')
2. Then, you can get outputStreamRedirect attribute for serverID.
>sysout=AdminConfig.showAttribute(serverID, 'outputStreamRedirect')
3. Now, you can compose attributes for specifying new location of log files.
Modify with following command:
>AdminConfig.modify(sysout, [['fileName', '${SERVER_LOG_ROOT}/new/SystemOut.log']])
>AdminConfig.modify(sysout, [['fileName', '${SERVER_LOG_ROOT}/new/SystemOut.log']])
4. Save the changes
>AdminConfig.save()
5. You can verify the change you made using following command.
>print AdminConfig.show(sysout)
6. Restart the JVM for the changes to take effect.
----------------------------------
----------------------------------
(2) SystemErr.log
----------------------------------
1. First, you need to get the configID for JVM you want to modify
>serverID=AdminConfig.getid('/Cell:Cell01/Node:Node01/Server:server1/')
2. Then, you can get errorStreamRedirect attribute for serverID.
>syserr=AdminConfig.showAttribute(serverID, 'errorStreamRedirect')
3. Now, you can compose attributes for specifying new location of log files.
Modify with following command:
>AdminConfig.modify(syserr, [['fileName', '${SERVER_LOG_ROOT}/new/SystemErr.log']])
>AdminConfig.modify(syserr, [['fileName', '${SERVER_LOG_ROOT}/new/SystemErr.log']])
4. Save the changes
>AdminConfig.save()
5. You can verify the change you made using following command.
>print AdminConfig.show(syserr)
6. Restart the JVM for the changes to take effect.
----------------------------------
----------------------------------
(3) native_stdout.log and native_stderr.log
----------------------------------
1. First, you need to get the configID for JVM you want to modify
----------------------------------
1. First, you need to get the configID for JVM you want to modify
>serverID=AdminConfig.getid('/Cell:Cell01/Node:Node01/Server:server1/')
2. Then, you can get configID for processDef object
>processDef=AdminConfig.list('ProcessDef', serverID)
3. Now, you can compose attributes for specifying new location of log files
>stderr = ['stderrFilename', '${SERVER_LOG_ROOT}/new/native_stderr.log']
>stdout = ['stdoutFilename', '${SERVER_LOG_ROOT}/new/native_stdout.log']
>attrs = [stderr, stdout]
>stdout = ['stdoutFilename', '${SERVER_LOG_ROOT}/new/native_stdout.log']
>attrs = [stderr, stdout]
4. Modify with following command using above variables.
>AdminConfig.modify(processDef, [['ioRedirect', attrs]])
5. Save the changes
>AdminConfig.save()
6. You can verify the change you made using following command.
>ior=AdminConfig.showAttribute(processDef,'ioRedirect')
>print AdminConfig.show(ior)
>print AdminConfig.show(ior)
7. Restart the JVM for the changes to take effect.
----------------------------------
----------------------------------
(4) activity.log
----------------------------------
1. First, you need to get the configID for JVM you want to modify
----------------------------------
1. First, you need to get the configID for JVM you want to modify
>serverID=AdminConfig.getid('/Cell:Cell01/Node:Node01/Server:server1/')
2. Then, you can get configID for ServiceLog object
>act=AdminConfig.list('ServiceLog', serverID)
3. Now, you can compose attributes for specifying new location of log files.
Modify with following command:
>AdminConfig.modify(act, [['name', '${LOG_ROOT}/new/activity.log']])
>AdminConfig.modify(act, [['name', '${LOG_ROOT}/new/activity.log']])
4. Save the changes
>AdminConfig.save()
5. You can verify the change you made using following command.
>print AdminConfig.show(act)
6. Restart the JVM for the changes to take effect.
----------------------------------
----------------------------------
(5) trace.log
----------------------------------
1. First, you need to get the configID for JVM you want to modify
>serverID=AdminConfig.getid('/Cell:Cell01/Node:Node01/Server:server1/')
2. Then, you can get configID for TraceService object and its attributes
>ts=AdminConfig.list('TraceService', serverID)
>traceLog=AdminConfig.list('TraceLog', ts)
>traceLog=AdminConfig.list('TraceLog', ts)
3. Now, you can compose attributes for specifying new location of log files
Modify with following command:
>AdminConfig.modify(traceLog, [['fileName', '${SERVER_LOG_ROOT}/new/trace.log']])
>AdminConfig.modify(traceLog, [['fileName', '${SERVER_LOG_ROOT}/new/trace.log']])
4. Save the changes
>AdminConfig.save()
5. You can verify the change you made using following command.
>print AdminConfig.showAttribute(traceLog,'fileName')
6. Restart the JVM for the changes to take effect.
----------------------------------
----------------------------------
References:
For more detail on wsadmin scripting tool, refer to the following links:
[Commands for the AdminConfig object using wsadmin scripting]
https://www.ibm.com/docs/was-nd/9.0.5?topic=scripting-commands-adminconfig-object-using-wsadmin
https://www.ibm.com/docs/was-nd/9.0.5?topic=scripting-commands-adminconfig-object-using-wsadmin
[{"Type":"SW","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"ARM Category":[{"code":"a8m50000000Cd8IAAS","label":"Logging-\u003ELogging: Misc"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]
Was this topic helpful?
Document Information
Modified date:
25 May 2021
UID
ibm16455593