WLST Command To Force Log Rotation Manually in Weblogic

Oracle Weblogic Server

When WebLogic Server instances are started in development mode, the server automatically renames (rotates) its local server log file as SERVER_NAME.log.n.

For the remainder of the server session, log messages accumulate in SERVER_NAME.log until the file grows to a size of 500 kilobytes.

Each time the server log file reaches this size, the server renames the log file and creates a new SERVER_NAME.log to store new messages.

By default, the rotated log files are numbered in order of creation filenamennnnn, where filename is the name configured for the log file.

You can configure a server instance to include a time and date stamp in the file name of rotated log files; for example, server-name-%yyyy%-%mm%-%dd%-%hh%-%mm%.log.

By default, when server instances are started in production mode, the server rotates its server log file whenever the file grows to 5000 kilobytes in size.

It does not rotate the local server log file when the server is started.

You can change these default settings for log file rotation. You can also specify the maximum number of rotated files that can accumulate.

After the number of log files reaches this number, subsequent file rotations delete the oldest log file and create a new log file with the latest suffix.

Note: WebLogic Server sets a threshold size limit of 500 MB before it forces a hard rotation to prevent excessive log file growth.

To Rotate via WLST :

#invoke WLST
C:\>java weblogic.WLST

#connect WLST to an Administration Server
wls:/offline> connect('username','password')

#navigate to the ServerRuntime MBean hierarchy
wls:/mydomain/serverConfig> serverRuntime()
wls:/mydomain/serverRuntime>ls()

#navigate to the server LogRuntimeMBean
wls:/mydomain/serverRuntime> cd('LogRuntime/servername')
wls:/mydomain/serverRuntime/LogRuntime/servername> ls()
-r-- Name servername
-r-- Type LogRuntime

-r-x forceLogRotation java.lang.Void :

#force the immediate rotation of the server log file
wls:/mydomain/serverRuntime/LogRuntime/servername> cmo.forceLogRotation()
wls:/mydomain/serverRuntime/LogRuntime/servername>

The server immediately rotates the file and prints the following message:

<Mar 12, 2012 3:23:01 PM EST> <Info> <Log Management> <BEA-170017> <The log file C:\diablodomain\servers\servername\logs\servername.log will be rotated. Reopen the log file if tailing has stopped. This can happen on some platforms like Windows.>

<Mar 12, 2012 3:23:01 PM EST> <Info> <Log Management> <BEA-170018> <The log file has been rotated to C:\diablodomain\servers\servername\logs\servername.log00001. Log messages will continue to be logged in C:\diablodomain\servers\servername\logs\servername.log.>
To specify the Location of the archived Log Files

The following command specifies the directory location for the archived log files using the -Dweblogic.log.LogFileRotationDir Java startup option:

 

java -Dweblogic.log.LogFileRotationDir=c:\foo -Dweblogic.management.username=installadministrator -Dweblogic.management.password=installadministrator weblogic.Server

 

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

10 Responses

  1. Srikanth Pe says:

    why manager server failed can tell me regain.

  2. Srikanth Pe says:

    can you do me a favor for me.. I am planing to do job trails on weblogic. can u tell me real time scenarios. I mean in production environment daily activities, and how to trouble shoot general and critical problems.

    • The question answer is really vast. there are thousand answer to your question , I am listing few..

      Apache configs: http://docs.oracle.com/cd/E13222_01/wls/docs81/plugins/apache.html

      Example Activities:

      • Installation, Configuration, Deployment, Clustering and Smoke test of weblogic and applications on Dev, QA, Staging and Production Environments.
      • Was actively involved in Level 2/3 support, Performance tuning, analysis and debug of issues related to implementation.
      • Supported installed product upgrade/degrade and patching activities.
      • Automation of deployments through shell scripts and maintenance activities done(jar file,war,ear patching).
      • Created reusable scripts in windows batch and shell scripts to monitor and report recurring issues in server logs and for maintenance of server JVM.
      • Was actively involved in creating production clone systems for disaster recovery.
      • Installed SSL certificates on apache webservers for secure communication.

      Manage server failure reasons:

      Its a very big question and what ever posts are there in welogic section of TechPaste is a reason.

      http://www.techpaste.com/category/application-servers/java-app-servers/oracle-bea-weblogic/

    • Srikanth Pe says:

      thank youuuuuuuuuuuuuuuu
      would send more information real time how to trouble shoot with screen shoots

  3. Srikanth Pe says:

    hi
    this is my interview question's.
    what is reason failure of manager server?
    how to integrated web server to weblogic?
    can tell me day to day activates?
    plz send me.

  4. ravi says:

    How to rotate managed server .out files.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.