How to Avoid WLST Information Messages and Run the scripts Silently

While running the WLST scripts, You might have come across the informational messages as follows and additional empty lines.

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connecting to t3://web.mwinventory.in:33011 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'mwidomain'.
-----
Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)

Having no option to disable this message at the JVM (or) at weblogic by default.

There  are various hacks available like using the Wrapper Shell script, Redirecting the output to log file printing etc. Well, we have our own recommendation.

A Simple Solution

The Solution we recommend is simple. All you have to do is whatever you print (or) want to display, add an additional space in the front 

Weblogic Application Status WLST

If you look at the preceding snip of the WLST script. The RED Rectangular boxes indicate WhiteSpace added at the front of what we print to the user.

Having added the Space to the statements we want, to be displayed. Our Next step is to filter the things we want using grep command

appstatusweblogic-wlst-output

As shown in the preceding snapshot,  I am executing my WLST script and grep the lines starts with space (^ ) and Lines starts with dashes (^--)

It will remove the empty lines and other weblogic information messages

I know it may not suit some people requirement. but I hope it helps with most of the cases.

The script shown in the snapshot can be downloaded from  here

For Best Practices and Other Exclusive Technology Articles and white papers.  Please stay connected to mwinventory by leaving your Name and Email in the following Subscription form. ( Trust me!. we hate Spam Emails just like you do )

Loading

Thanks,

A K S A R A V

Write to us at [email protected]

 Follow us on Facebook

 To Join our Community in Whatsapp – Click here