WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool


Before You Begin


This tutorial shows you how to use the WebLogic Scripting Tool (WLST) to administer Oracle WebLogic Server 12c (12.2.1) from the command line.

Time to Complete

Approximately 15 Minutes.


With WLST, you can monitor, control, and configure servers and other domain resources from the command line. You can also save groups of commands in files so that you can reliably perform the same tasks many times.
This tutorial introduces you to WLST. It gives you a chance to practice basic commands and to change server attributes from the command line.

What Do You Need?

You should have completed the following Oracle by Example tutorials:

Running WLST in Interactive Mode

The administration server does not have to be running to access WLST. However, in this tutorial, because WLST connects to the administration server, it must be running.

To run WLST in interactive mode, perform the following steps:

  1. If the administration server of the domain is not already running, open a Terminal window and navigate to the domain directory for this tutorial:
    $ cd /scratch/u01/app/fmw/user_projects/domains/mydomain
  2. At the prompt, enter the following command:
    $ ./startWebLogic.sh
  3. At the prompt, enter the domain administrator's credentials.
    Enter username to boot WebLogic server:weblogic
    Enter password to boot WebLogic server:<welcome1>

    Note:The password is not visible for security reasons.

  4. In a new Terminal window, navigate to middleware home for this tutorial:
    $ cd /scratch/u01/app/fmw/
  5. Change the directory:
    $ cd oracle_common/common/bin
  6. Run the wlst.sh script.
    $ ./wlst.sh 
    Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands wls:/offline>

    If you are accessing WLST for the first time, Jython scans the Java Archive (JAR) files that the WLST depends on before the welcome message and the WLST offline prompt are displayed.

Changing a Server Property

To change a server property by using WLST in interactive mode, perform the following steps:

  1. At the WLST prompt, enter the following command to connect to the running administration server:
    Replace the sample argument values with those that match your domain environment. In this tutorial, the command is:
    Connecting to t3://localhost:7001 with userid weblogic ... Successfully connected to Admin Server "AdminServer" that belongs to domain "mydomain". Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead. wls:/mydomain/serverConfig/>

    Note: WLST always uses the t3 (or t3s) proprietary protocol to connect to a server.

  2. Change to edit mode:
    Location changed to edit tree. 	 
    This is a writable tree with DomainMBean as the root. 	 
    To make changes you will need to start an edit session via startEdit(). 
    For more help, use help('edit').
  3. Start an edit session to lock the configuration:
    Starting an edit session ...
    Started edit session, be sure to save and activate your changes once you are done.
    wls:/mydomain/edit/ !>
  4. Change to the Log directory of your administration server:

    Replace the sample argument values with those that match your domain environment. In this tutorial, the command is:

    wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>
  5. Set the FileCount property of the administration server log file to 8, and then use the ls() command to check whether the server property was changed.
    wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>
    dr--   DomainLogBroadcastFilter
    dr--   LogFileFilter
    dr--   MemoryBufferFilter
    dr--   StdoutFilter
    -rw-   BufferSizeKB                                 8
    -rw-   DateFormatPattern                            MMM d, yyyy h:mm:ss a z
    -rw-   DomainLogBroadcastFilter                     null
    -rw-   DomainLogBroadcastSeverity                   Notice
    -rw-   DomainLogBroadcasterBufferSize               10
    -r--   DynamicallyCreated                           false
    -rw-   FileCount                                    8
    -rw-   FileMinSize                                  5000
    -rw-   FileName                                     logs/AdminServer.log
    -rw-   FileTimeSpan                                 24
    -r--   Id                                           0
    -rw-   Log4jLoggingEnabled                          false
    -rw-   LogFileFilter                                null
    -rw-   LogFileRotationDir                           null
    -rw-   LogFileSeverity                              Trace
    -rw-   LogMonitoringEnabled                         true
    -rw-   LogMonitoringIntervalSecs                    30
    -rw-   LogMonitoringThrottleMessageLength           50
    -rw-   LogMonitoringThrottleThreshold               1500
    -rw-   LoggerSeverity                               Info
    -rw-   LoggerSeverityProperties                     null
    -rw-   MemoryBufferFilter                           null
    -rw-   MemoryBufferSeverity                         Trace
    -rw-   MemoryBufferSize                             500
    -rw-   Name                                         AdminServer
    -rw-   Notes                                        null
    -rw-   NumberOfFilesLimited                         true
    -rw-   PlatformLoggerLevels                         null
    -rw-   RedirectStderrToServerLogEnabled             false
    -rw-   RedirectStdoutToServerLogEnabled             false
    -rw-   RotateLogOnStartup                           false
    -rw-   RotationTime                                 00:00
    -rw-   RotationType                                 bySize
    -rw-   ServerLoggingBridgeUseParentLoggersEnabled   false
    -rw-   StdoutFilter                                 null
    -rw-   StdoutFormat                                 standard
    -rw-   StdoutLogStack                               true
    -rw-   StdoutSeverity                               Notice
    -rw-   Tags                                         null
    -r--   Type                                         Log
    -r-x   addTag                                       Boolean : String(tag)
    -r-x   freezeCurrentValue                           Void : String(attributeName)
    -r-x   getInheritedProperties                       String[] : String[](propertyNames)
    -r-x   isInherited                                  Boolean : String(propertyName)
    -r-x   isSet                                        Boolean : String(propertyName)
    -r-x   removeTag                                    Boolean : String(tag)
    -r-x   restoreDefaultValue                          Void : String(attributeName)
    -r-x   unSet                                        Void : String(propertyName)
    wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>                              

  6. Save and activate the changes:

    Saving all your changes ...
    Saved all your changes successfully.
    wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>
    Activating all your changes, this may take a while ... 
    The edit lock associated with this edit session is released once the activation is completed.
    Activation completed

Shutting Down the Administration Server

To shut down the administration server of the domain by using WLST in interactive mode, perform the following steps:

  1. At the WLST prompt, enter the following command:
    Shutting down the server AdminServer with force=false while connected to AdminServer ...
    Disconnected from weblogic server: AdminServer
    WLST lost connection to the WebLogic Server that you were connected to. 
    This may happen if the server was shut down or partitioned. 	 
    You will have to re-connect to the server once the server is available.
    Disconnected from weblogic server: AdminServer

    Note: By default, the WLST shutdown() command shuts down the server to which it is connected.
  2. At the prompt, enter the following command to exit WLST:
    wls:/offline> exit()
    Exiting WebLogic Scripting Tool.

Want to Learn More?


  • Lead Curriculum Developer: Tom Eliason, Veerabhadra Rao Putrevu
  • Other Contributors: Susan Moxley


  • 01-32-001-UsingWLST