BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.management.configuration
Interface LogMBean


public interface LogMBean
extends ConfigurationMBean

Configures the location, file-rotation criteria, and number of files that a WebLogic Server uses to store log messages. The methods in this class configure both server and domain log files.

Author:
Copyright © 2004 BEA Systems, Inc. All Rights Reserved.

Field Summary
static java.lang.String DEFAULT_FILE_NAME
          The default value for the log file name.
static int MAX_ROTATED_FILES
          The maximum number that you can specify for FileCount.
static java.lang.String NONE
          No logfile rotation.
static java.lang.String SIZE
          Rotation based on file size.
static java.lang.String TIME
          Rotation based on elapsed time.
static java.lang.String TIME_FORMAT
          The format string for the rotation start time.
 
Fields inherited from class weblogic.management.configuration.ConfigurationMBean
CACHING_STUB_SVUID, DEFAULT_EMPTY_BYTE_ARRAY
 
Method Summary
 int getFileCount()
          The maximum number of log files that the server creates when it rotates the log.
 int getFileMinSize()
          The size (1 - 65535 kilobytes) that triggers the server to move log messages to a separate file.
 java.lang.String getFileName()
          The name of the file that stores current log messages.
 int getFileTimeSpan()
          The interval (in hours) at which the server saves old log messages to another file.
 java.lang.String getRotationTime()
          Determines the start time (hour and minute) for a time-based rotation sequence.
 java.lang.String getRotationType()
          Criteria for moving old log messages to a separate file: NONE.
 boolean isNumberOfFilesLimited()
          Indicates whether a server will limit the number of log files that it creates when it rotates the log.
 void setFileCount(int numberOfFiles)
          The maximum number of files that the server creates to store old log messages.
 void setFileMinSize(int kBytes)
          The size (1 - 65535 kilobytes) that triggers the server to move log messages to a separate file.
 void setFileName(java.lang.String fileName)
          The name of the file that stores current log messages.
 void setFileTimeSpan(int hours)
          The interval (in hours) at which the server saves old log messages to another file.
 void setNumberOfFilesLimited(boolean value)
          Limits the number of files that a server creates to store old messages to the maximum number specified in FileCount.
 void setRotateLogOnStartup(boolean value)
           
 void setRotationTime(java.lang.String when)
          Determines the start time (hour and minute) for a time-based rotation sequence.
 void setRotationType(java.lang.String rotationType)
          Criteria for moving old log messages to a separate file: NONE.
 
Methods inherited from interface weblogic.management.configuration.ConfigurationMBean
freezeCurrentValue, getNotes, restoreDefaultValue, setComments, setDefaultedMBean, setNotes, setPersistenceEnabled
 
Methods inherited from interface weblogic.management.WebLogicMBean
getMBeanInfo, getName, getObjectName, getParent, getType, isCachingDisabled, isRegistered, setName, setParent
 
Methods inherited from interface javax.management.DynamicMBean
getAttribute, getAttributes, invoke, setAttribute, setAttributes
 
Methods inherited from interface javax.management.MBeanRegistration
postDeregister, postRegister, preRegister
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 

Field Detail

SIZE

public static final java.lang.String SIZE
Rotation based on file size.

TIME

public static final java.lang.String TIME
Rotation based on elapsed time.

NONE

public static final java.lang.String NONE
No logfile rotation. Note that WebLogic Server sets a threshold size limit of 500 MB before it forces a hard rotation to prevent excessive log file growth.

TIME_FORMAT

public static final java.lang.String TIME_FORMAT
The format string for the rotation start time.

DEFAULT_FILE_NAME

public static final java.lang.String DEFAULT_FILE_NAME
The default value for the log file name.

MAX_ROTATED_FILES

public static final int MAX_ROTATED_FILES
The maximum number that you can specify for FileCount.
Method Detail

getFileName

public java.lang.String getFileName()
The name of the file that stores current log messages. Usually it is a computed value based on the name of the parent of this MBean. For example, for a server log it is serverName.log.

However, if name of the parent cannot be obtained for some reason, then the name is weblogic.log.

A relative pathname is relative to the server's root directory.

A configurable MBean attribute
Default Value: DEFAULT_FILE_NAME
Old Property: weblogic.system.logFile
Returns:
The fileName value

setFileName

public void setFileName(java.lang.String fileName)
                 throws javax.management.InvalidAttributeValueException
The name of the file that stores current log messages. If you specify a relative pathname, it is interpreted as relative to the server's root directory.

To include a time and date stamp in the file name when the log file is rotated, add java.text.SimpleDateFormat variables to the file name. Surround each variable with percentage (%) characters.

For example, if the file name is defined to be myserver_%yyyy%_%MM%_%dd%_%hh%_%mm%.log, the log file will be named myserver_yyyy_mm_dd_hh_mm.log.

When the log file is rotated, the rotated file name contains the date stamp. For example, if the log file is rotated on 2 April, 2003 at 10:05 AM, the log file that contains the old messages will be named myserver_2003_04_02_10_05.log.

If you do not include a time and date stamp, the rotated log files are numbered in order of creation. For example, myserver.log0007.

Parameters:
fileName - The new fileName value
Throws:
javax.management.InvalidAttributeValueException -  
See Also:
MachineMBean

getRotationType

public java.lang.String getRotationType()
Criteria for moving old log messages to a separate file:

After the server renames a file, subsequent messages accumulate in a new file with the name that you specified in FileName.

A dynamic MBean attribute
Returns:
SIZE, TIME or NONE.

setRotationType

public void setRotationType(java.lang.String rotationType)
                     throws javax.management.InvalidAttributeValueException
Criteria for moving old log messages to a separate file:

After the server renames a file, subsequent messages accumulate in a new file with the name that you specified in FileName.

Default Value: SIZE
Legal Values: SIZE,TIME,NONE
Secure Value:  TIME
Parameters:
rotationType - SIZE, TIME or NONE.
Throws:
javax.management.InvalidAttributeValueException -  

setNumberOfFilesLimited

public void setNumberOfFilesLimited(boolean value)
                             throws javax.management.InvalidAttributeValueException,
                                    DistributedManagementException
Limits the number of files that a server creates to store old messages to the maximum number specified in FileCount. After the server reaches this limit, it deletes the oldest log file and creates a new log file with the latest suffix.

If you do not enable this option, the server creates new files indefinitely. You must clean up these files as you require.

This value is relevant only if you specify a file rotation type of SIZE or TIME.

A dynamic MBean attribute
Secure Value:  false
Parameters:
value - The new numberOfFilesLimited value
Throws:
javax.management.InvalidAttributeValueException -  
DistributedManagementException -  

isNumberOfFilesLimited

public boolean isNumberOfFilesLimited()
Indicates whether a server will limit the number of log files that it creates when it rotates the log. The limit is based on getFileCount.

Default Value: false
Returns:
The numberOfFilesLimited value

getFileCount

public int getFileCount()
The maximum number of log files that the server creates when it rotates the log. Only valid if isNumberOfFilesLimited is true and setRotationType is either Size or Time.

Default Value: 7
Returns:
The fileCount value

setFileCount

public void setFileCount(int numberOfFiles)
                  throws javax.management.InvalidAttributeValueException,
                         DistributedManagementException
The maximum number of files that the server creates to store old log messages. This number does not include the file that the server uses to store current messages (the name of which you specify in FileName). This value is relevant only if you enable NumberOfFilesLimited.

A dynamic MBean attribute
Legal Value: (value <= LogMBean.MAX_ROTATED_FILES && value > 0 )
Parameters:
numberOfFiles - The new fileCount value
Throws:
javax.management.InvalidAttributeValueException -  
DistributedManagementException -  

getFileTimeSpan

public int getFileTimeSpan()
The interval (in hours) at which the server saves old log messages to another file. This value is relevant only if you use the time-based rotation type.

Default Value: 24
Returns:
The fileTimeSpan value

getRotationTime

public java.lang.String getRotationTime()
Determines the start time (hour and minute) for a time-based rotation sequence. At the time that this value specifies, the server renames the current log file. Thereafter, the server renames the log file at an interval that you specify in FileTimeSpan.

Use the following format: k:mm, where

If the specified time has already past, then the server starts its file rotation immediately.

By default, the rotation cycle begins immediately.

Returns:
The rotationTime value

setRotationTime

public void setRotationTime(java.lang.String when)
                     throws javax.management.InvalidAttributeValueException
Determines the start time (hour and minute) for a time-based rotation sequence. At the time that this value specifies, the server renames the current log file. Thereafter, the server renames the log file at an interval that you specify in FileTimeSpan.

Use the following format: k:mm, where

If the specified time has already past, then the server starts its file rotation immediately.

By default, the rotation cycle begins immediately.

A dynamic MBean attribute
A configurable MBean attribute
Default Value: 00:00
Legal Value: LoggingLegalHelper.isLogStartTimeValid(LogMBean.TIME_FORMAT, value)
Parameters:
when - The new rotationTime value
Throws:
javax.management.InvalidAttributeValueException -  

setFileTimeSpan

public void setFileTimeSpan(int hours)
                     throws javax.management.InvalidAttributeValueException,
                            DistributedManagementException
The interval (in hours) at which the server saves old log messages to another file. This value is relevant only you use the time-based rotation type.

A dynamic MBean attribute
Legal Minimum Value: 1
Parameters:
hours - The new fileTimeSpan value
Throws:
javax.management.InvalidAttributeValueException -  
DistributedManagementException -  

getFileMinSize

public int getFileMinSize()
The size (1 - 65535 kilobytes) that triggers the server to move log messages to a separate file. After the log file reaches the specified minimum size, the next time the server checks the file size, it will rename the current log file as FileName.n and create a new one to store subsequent messages. (This field is relevant only if you set Rotation Type to By Size.)

A configurable MBean attribute
Default Value: 500
Production Mode Default Value: 5000
Old Property: weblogic.system.maxLogFileSize
Returns:
The fileMinSize value

setFileMinSize

public void setFileMinSize(int kBytes)
                    throws javax.management.InvalidAttributeValueException,
                           DistributedManagementException
The size (1 - 65535 kilobytes) that triggers the server to move log messages to a separate file. After the log file reaches the specified minimum size, the next time the server checks the file size, it will rename the current log file as FileName.n and create a new one to store subsequent messages. (This field is relevant only if you set Rotation Type to By Size.)

A dynamic MBean attribute
Legal Minimum Value: 1
Legal Maximum Value: 65535
Parameters:
kBytes - The new fileMinSize value
Throws:
javax.management.InvalidAttributeValueException -  
DistributedManagementException -  

setRotateLogOnStartup

public void setRotateLogOnStartup(boolean value)


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81