Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

WebLogic Domain Log files Tips

Weblogic Tips by Donald BurlesonApril 7, 2015

Configure WebLogic Domain and Server Logging Settings

The domain creates log files and every server - including the admin sever - also creates log files.  Especially for production systems, log files must be saved for future reviews. Log files must also be rotated in order to limit size or separate timeframes. For example, this may result in having one log file for each day. 

      

On production systems, it is a good practice to rotate log files once per day. This makes it easy for scheduled processes to move old log files to a backup or log server in order to save disk space and to avoid filling the local disk with logs. For example, rotating logs every day at 2am means that a scheduled process can run at 2:30am and move the old log file away.

The WebLogic Domain Log File

The following in an example for changing the settings for the domain log.

 

Offline example for rotating based on time during domain creation:

 

create('TestDomain', 'Log')

cd('/Log/TestDomain')

cmo.setRotationType('byTime')

cmo.setRotationTime('02:00')

cmo.setFileTimeSpan(24)

cmo.setNumberOfFilesLimited(true)

cmo.setFileCount(7)

cmo.setFileMinSize(10000)

 

During domain creation, we need to create the "Log" entry underneath the domain first, otherwise the cd command will fail. Then you can set the desired log settings. You can set the rotation time based on size or time, and you can set log file sizes and amount of files, as well as a number of other settings.  The settings which are available and which make sense depend on the rotation time.

 

Offline example for rotating based on size during domain creation:

 

create('TestDomain', 'Log')

cd('/Log/TestDomain')

cmo.setRotationType('bySize')

cmo.setRotateLogOnStartup(false)

cmo.setFileCount(18)

cmo.setNumberOfFilesLimited(false)

cmo.setFileMinSize(10000)

 

For the domain itself, a default (even if empty) LOG branch will be created if not done by you (see above). This means that in this case for an online script, we do not need to create this MBean. Therefore, in the online example below, the create statement is missing. Log file settings must be done on the Edit-MBeanServer, therefore we need to switch to the edit mode first and then we can change these settings.

 

Online example:

 

connect(...)

edit()

startEdit()

cd('/Log/TestDomain')

cmo.setRotationType('bySize')

cmo.setRotateLogOnStartup(false)

cmo.setFileCount(18)

cmo.setNumberOfFilesLimited(false)

cmo.setFileMinSize(10000)

activate()

disconnect()

 

The WebLogic Administration Server Logs

Logs for the administration server are a little bit different than for the domain. With the admin server we are touching a real server, which consists of multiple log files. Not all of them can be configured using WLST-MBeans.  The files which can be configured are the server log file and the server access file.  These two are located in two different MBeans

 

Offline example while creating the domain for AdminServer log-settings:

 

# change settings for the server log

cd('/Server/AdminServer')

create('AdminServer', 'Log')

cd('/Servers/AdminServer/Log/AdminServer')

 

# set rotation type , time and other information

cmo.setRotationType('byTime')

cmo.setRotationTime('02:00')

cmo.setFileTimeSpan(24)

cmo.setNumberOfFilesLimited(true)

cmo.setFileCount(7)

cmo.setRotateLogOnStartup(true)

 

cd('/Server/'+servername)

create(servername, 'WebServer')

cd('/Server/'+servername+'/WebServer/'+servername)

 

See the book code download for full script

 

# now do the same for the access log but you need another mbean

create(servername, 'WebServerLog')

cd('/Server/'+servername+'/WebServer/'+servername+'/WebServerLog/'+servername)

cmo.setRotationTime('02:00')

cmo.setRotationType('byTime')

cmo.setFileTimeSpan(24)

cmo.setFileCount(14)

cmo.setFileName(serverLogPath+'/access.log')

 

The above script only shows some of the possible settings which are available for logging.  In addition to the above, settings like LogFileRotationDir, filters, and more can be configured.

Changing the WebLogic Logs of all Managed-Servers

The following is actually an example for a common server farm requirement, especially for production systems. For production systems, it is common to dedicate the admin server to administration tasks only and delegate the application work to all the managed-servers. This means that usually all managed servers have different log file requirements than the admin server.

 

This script shows two nice WLST features:

?  Iterating over all servers of a domain

?  Settings options depending on a server name

Example script for changing log settings for all managed server but NOT for the AdminServer:

 

# connect to the adminserver and start an edit session

connect(...)

edit()

startEdit()

 

print 'Iterate over the managed servers and set the log settings for all managed servers ';

domainConfig()

 

# get the list of servers from the config MBean tree

svrs = cmo.getServers()

 

# switch to the domain runtime tree

domainRuntime()

for server in svrs:

      # Do not set the log settings for the adminserver

      myServerName = server.getName()

      if myServerName != 'AdminServer':

               # set the log settings

               cd('/Servers/'+myServerName+'/Log/'+myServerName)

               cmo.setRotationType('byTime')

               cmo.setRotationTime('02:00')

               cmo.setFileTimeSpan(24)

               cmo.setNumberOfFilesLimited(true)

               cmo.setFileCount(7)

               cmo.setRotateLogOnStartup(true)

 

# activate the changes

activate()

disconnect()

 

The normal log file MBean for a server is located at:

 

 /Servers/<serverName>/Log/<serverName>. 

 

For example, for the AdminServer this is /Servers/AdminServer/Log/AdminServer. 

The log file MBean for http access is located at:

 

/Servers/<serverName>/WebServer/<serverName>/WebServerLog/<serverName>

 

For production and production-like systems, it is necessary to separate the logs from the domain installation. Logs will grow and will likely need other file system access rights. Logs should also be saved on their own file system to protect the domains. For all production systems I have been involved with, logs have been saved outside of the domain file system tree.

 

In order to change the location of all logs, there are a couple of steps necessary as we are talking about different files.  The files involved include

?  The domain log

?  The AdminServer log

?  The AdminServer stdout, stderr

?  The AdminServer access log

?  The logs of each managed-server

?  The stdout, stderr of each managed-server

?  The access log of each managed-server

The following table provides an overview what needs to be done in order to really move all logs to a separate location.


 

domain log

Can be changed via WLST. Should be changed during domain creation:

Use

cd('/Log/<domainName>')

cmo.setFileName(<new log location>)

to change the location of this log file

AdminServer log

Can be changed via WLST. Should be changed during domain creation:

Use

[.. mbean creation if needed ...]

cd('/Server/AdminServer/Log/AdminServer')

cmo.setFileName(<new log location and name>)

to change the location of this log file

AdminServer stdout, stderr

This cannot be done with WLST as the AdminServer is normally started using the startWeblogic script from the domain Root.  What you can do is to overwrite this file during domain creation and add system redirections.

e.g. for Linux replace the last line this script with

${DOMAIN_HOME}/bin/startWebLogic.sh $*  >> <outfile location> 2>> <errorfile location>

AdminServer access log

Can be changed via WLST. Should be changed during domain creation:

Use

[.. mbean creation if needed ...]

cd('/Server/AdminServer/WebServer/AdminServer/WebServerLog/AdminServer')

cmo.setFileName(<new access log location and name>)

to change the location of this log file

logs of each managed server

Can be changed via WLST. Should be changed during domain creation:

Use

[.. mbean creation if needed ...]

cd('/Server/<servername>/Log/<servername>)

cmo.setFileName(<new log location and name>)

to change the location of this log file

stdout, stderr of each managed-server

This really depends how you start the managed-server.

If you start the managed-server with a script, then you can do the same as described above for the admin server out/err

If you start the managed-server using the NodeManager (which is the preferred way) you can do this via WLST. In this case you need to add two arguments to the ServerStart MBean. (See adding managed-server section for more details).  You need to add the options -Dweblogic.Stdout=<outfile> and  -Dweblogic.Stderr=<errorfile>

access log of each managed server

Can be changed via WLST. Should be changed during domain creation:

Use

[.. mbean creation if needed ...]

cd('/Server/'+servername+'/WebServer/'+servername+'/WebServerLog/'+servername)

cmo.setFileName(<new log path>+'/access.log')

to change the location of this log file

Table 5.1: Changing Logs

In production systems, it has worked out well if you combine all logs from one machine in a single place. For example, you can use "/logs" as root folder for all logs and then create a directory for each domain under this root folder.  In the domain folder you can place the domain log(s), and in the domain folder you can create a subfolder for each server (including the AdminServer).  The creation of these directories can be done with WLST while you configure your domain.

 

For example:

 

domainLogPath = <logsDirectory>+"/"+<domainName>;

try:

     os.makedirs(domainLogPath);

except:

     print 'Unable to create domain root log path - please check !';

print('Setting Domain Log...');

create(<domainName>, 'Log')

cd('/Log/'+<domainName>)

cmo.setFileName(domainLogPath+'/'+<name of domain log>)

 

Note that the complete domain creation example will contain this.

 

 
   
Advanced WebLogic Server Automation Book

The above is an excerpt from the book "Advanced WebLogic Server Automation: Administration and Monitoring with WLST and JMX". This book covers everything administrators need to know for WebLogic scripting and automation, and includes a comprehensive code download of powerful WLST and JMX scripts.
 


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster