Debugging adding log4j to Jython for nice Logging in WebSphere automation scripts.

Error:


C:\scripts>"C:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.bat" -lang jython -f "C:/scripts/gen.
py" "c:/scripts/gen.props"
WASX7209I: Connected to process "server1" on node myNode01 using SOAP connector;  The type of process is: UnManagedProcess
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored
in the argv variable: "[c:/scripts/gen.props]"
WASX7017E: Exception received while running file "C:/scripts/gen.py"; exception information: com.ibm.bsf.BSFException: e
xception from Jython:
Traceback (innermost last):
File "<string>", line 1, in ?
ImportError: No module named log4j

Solution: Is to ensure that the log4j JAR file is in the class path for wsadmin. You can do this by simply adding the log4J JAR file to <was_root>>/lib/ext folder.

If you want code that shows you how to use log4j in WAS then contact me.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply