What do do when you get an error using Log4j in your Jython scripts…

Reason:

Well, my Jython code was using Log4j and I had not included a properties file. How do I know this? We see the last three lines. Sometimes in a stack trace you need to be able to look for lines that are relevant to your error.

Solution:

Add a log4j.properties file to the class path.

Note: If you want to use Log 4j in your WebSphere Jython scripts, then you will need to ensure you modify the wsadmin.properties file in your profile (DMGR for ND) to ensure wsadmin knows where log4j.jar file is located. The wsadmin.properties file is located in <profile_root>/properties and the section to edit is shown below with an example. You can download log4j from the net.


#-------------------------------------------------------------------------
# The classpath property is appended to the list of paths to search for
# classes and resources.
# There is no default value.
#-------------------------------------------------------------------------
com.ibm.ws.scripting.classpath=c:/scripts;c:/scripts/lib

The code to use log4j can be found here in the WorkManager Jython example.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply