Extend WLST with your custom commands

Recently I was writing a simple WLST script to monitor a weblogic domain. After a lot of tests and thoughts I develop a decent script that satisfy my monitor needs. While writing the script I wrote a few functions that I use them a lot. So, I think why not to add them in standard WLST commands of WLST, in order to be available whenever run WLST.
How can you add custom WLST commands in WLST??

The solution is very simple. You write your custom functions to one or more ‘.py’ script(s) and save them to ‘WL_HOME/common/wlst/lib’ directory. Any file added to this directory will be compiled automatically from WLST and will be imported by WLST when started. See the next simple example.


def HelloCmd():
    print 'Hello dude'

Now, you can call this function in WLST offline mode like this:


Hope it helps,
Adrianos Dadis

Democracy Requires Free Software.


About Adrianos Dadis

Building Big Data & Stream processing solutions in many business domains. Interested in distributed systems and enterprise integration.
This entry was posted in Administration, Weblogic and tagged , . Bookmark the permalink.

Post your thought

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s