MBeans related to Logger
From the above sample code the MBean can be initialized by the following string representation of the object name.
Fiorano.Loggers:ServiceType=Logger,Name=%LoggerName%
Here the %LoggerName% refers to the name of the logger for a particular MBean.
Valid Logger Names are:
-
-
-
Fiorano.Deprecated.FMQPublishSubscribeServices
-
Fiorano.Deprecated.RDBMS_RECONNECT
-
Fiorano.FMQ.Events.ResourceManager
-
Fiorano.Deprecated
-
Fiorano.FMQ.Events.Tcf
-
Fiorano.FMQ.Queues.PUSH
-
Fiorano.FMQ.Events.QueueSender
-
Fiorano.FMQ.Queues.PUSH.Message
-
Fiorano.Deprecated.XA
-
Fiorano
-
Fiorano.JMX.Listeners
-
Fiorano.JMX.Operations
-
Fiorano.FMQ.Events.QueueConnection
-
Fiorano.FMQ.Events.TopicConnection
-
Fiorano.Deprecated.GMS
-
Fiorano.Services.DefaultMQObjects
-
Fiorano.FMQ.Operations
-
Fiorano.Deprecated.FMQNamingManagerServices
-
Fiorano.FMQ.Topics.Connection.ConConsumer.Manager
-
Fiorano.Deprecated.FMQAdminServices
-
Fiorano.FMQ.Events.TopicPublisher
-
Fiorano.Deprecated.ExMessage
-
Fiorano.Deprecated.FMQConnectionManagerServices
-
Fiorano.FMQ.Events.Dmq
-
Fiorano.Deprecated.ThreadManager
-
Fiorano.FMQ.Topics.MsgFlow.Publish
-
Fiorano.Deprecated.ClientLogManager
-
Fiorano.FMQ.Topics.Connection.ConConsumer
-
Fiorano.FMQ.Topics.Connection
-
Fiorano.Deprecated.QGMS
-
Fiorano.Deprecated.MemoryManager
-
Fiorano.Deprecated.ConnectionCreation
-
Fiorano.FMQ.Topics.TCF
-
Fiorano.FMQ.Events
-
Fiorano.FMQ.Queues
-
Fiorano.Deprecated.Snooper
-
Fiorano.Deprecated.CBR
-
Fiorano.Deprecated.SocketRead
-
Fiorano.FMQ.Topics
-
Fiorano.Deprecated.StubManager
-
Fiorano.Deprecated.Cache
-
Fiorano.Deprecated.Realm
-
Fiorano.FMQ.Queues.POP
-
Fiorano.Deprecated.FMQPointToPointServices
-
Fiorano.FMQ
-
Fiorano.Services
-
Fiorano.FMQ.Events.Topic
-
Fiorano.FMQ.Queues.COMMIT
-
Fiorano.Deprecated.Expiration
-
Fiorano.Deprecated.LogError
-
Fiorano.Deprecated.PubSubSlowDown
-
Fiorano.FMQ.Topics.MsgFlow
-
Fiorano.Deprecated.NamingManager
-
Fiorano.FMQ.Queues.Browse
-
Fiorano.Deprecated.RouteManagerService
-
Fiorano.FMQ.Events.Qcf
-
Fiorano.JMX
-
Fiorano.FMQ.Topics.MsgFlow.Message
-
Fiorano.FMQ.Lookup
-
Fiorano.Deprecated.PurgeDeliveredPersistentMessage
-
Fiorano.Deprecated.RDBMS
-
Fiorano.FMQ.Events.QueueReceiver
-
Fiorano.Deprecated.FMQThreadManagerServices
-
Fiorano.JMX.Attributes
-
Fiorano.Deprecated.Consumer
-
Fiorano.FMQ.Ping
-
Fiorano.Deprecated.Administrator
-
Fiorano.Deprecated.JobManager
-
Fiorano.FMQ.Events.Queue
-
Fiorano.Deprecated.ConnectionManager
-
Fiorano.Deprecated.ConnectionClose
-
Fiorano.FMQ.Events.TopicSubscriber
-
Fiorano.Services.ObjectManager
-
-
Operations of Logger
Adding Appenders
Syntax:
void addAppender(fiorano.jms.log.def.config.AppenderConfig config) throws FioranoException
Description: Adds an appender to the current logger, by default there are no appenders.
Return Type: null
Parameters: AppenderConfig () contains the configuration of the Appender.
Constructor: public AppenderConfig()
Major Properties that can be set by the user for the AppenderConfig are:
-
AppenderType: Type of the Appender, possible values are console and file.
-
AppenderName: Name of the Appender
public void setAppenderName(String name)
-
LogPattern: This is Log4J specfic format for printing logs. Please refer to Log4J documentation for more details.
Example: {%F, %M} %-5p [%c{1}] %m%n will print CodeFileName, MethodName where the log event is generated public void setLogPattern(String log)
-
PrintTarget: Applicable to Console appender only.
Example: System.out and System.err public void setPrintTarget(String str)
-
Threshold Level: Log events logged above this log level will not be received/logged by this Appender
public void setThresholdLevel(int level)
-
Minimum Filter Level: Minimum Filter level for Log events. Events logged below this log level will not be received/logged by this Appender
public void setMinFilterLevel(intlevel)
-
Maximum Filter Level: Maximum Filter level for Log events. Events logged above this log level will not be received/logged by this Appender
public void setMaxFilterLevel(intlevel)
-
Filter Pattern: Regex based string filter pattern for filtering the log events received by this Appender. Only Events which matches the filter criteria are logged.
public void setFilterPattern(String str)
-
File Name: Log file name. This file is by Rolling File Appender for logging log events. Eg mqout.log and mqerr.log
public void setFileName(String filename)
-
Maximum File Size: Maximum size of a log file in bytes. Please refer to log4j documentation for more details.
public void setMaxFileSize(String max)
-
Maximum BackUp Index: Maximum number of log files to be used.
Example: setting it to 2 , will have 3 log files. file.log, file1.log, file2.log public void setMaxBackupIndex(int max)
-
Is Append: File logging mode(Append/Not append).
If true, log events are appended to already present logs in file(s). public void setIsAppend(boolean append)
Adding File Appender
Syntax:
void addFileAppender (String name, String fileName, String maxFileSize, int maxBackupIndex, String pattern, boolean append, int thresholdLevel, int minLevel, int maxLevel, String filterPattern) throws FioranoException
Description: Adds a File appender to this logger
Return: null
Parameters:
-
name: Name of the Appender
-
fileName: Log file name. This file is by Rolling File Appender for logging log events.
Example: server.log
-
maxFileSize: Maximum size of a log file in bytes. Please refer to log4j documentation for more details.
-
MaxBackupIndex: Maximum number of log files to be used.
Example: 2 means, we will have 3 log files. file.log, file1.log, file2.log
-
pattern: This is Log4J specific format for printing logs. Please refer to Log4J documentation for more details.
Example: {%F, %M} %-5p [%c{1}] %m%n will print CodeFileName, MethodName where the log event is generated
-
append: File logging mode(Append/Not append).
If true, log events are appended to already present logs in file(s).
-
thresholdLevel: Log events logged above this log level will not be received/logged by this Appender
-
minLevel: Minimum Filter level for Log events. Events logged below this log level will not be received/logged by this Appender
-
maxLevel: Maximum Filter level for Log events. Events logged above this log level will not be received/logged by this Appender
-
filterPattern: Regex based string filter pattern for filtering the log events received by this Appender. Only Events which matches the filter criteria are logged.
Adding Console Appenders
Syntax:
void addConsoleAppender(String name, String pattern, String target, int thresholdLevel, int minLevel, int maxLevel, String filterPattern) throws FioranoException
Description: Adds a console appender to this logger
Return Type: Null
Parameters:
-
name: Name of the Appender
-
pattern: This is Log4J specfic format for printing logs. Please refer to Log4J documentation for more details.
Example: {%F, %M} %-5p [%c{1}] %m%n will print CodeFileName, MethodName where the log event is generated
-
target: Applicable to Console appender only.
Example: System.out and System.err
-
thresholdLevel: Log events logged above this log level will not be received/logged by this Appender
-
minLevel: Minimum Filter level for Log events. Events logged below this log level will not be received/logged by this Appender
-
maxLevel: Maximum Filter level for Log events. Events logged above this log level will not be received/logged by this Appender
-
filterPattern: Regex based string filter pattern for filtering the log events received by this Appender. Only Events which matches the filter criteria are logged.
Clearing Logs
Syntax:
void clearLogs(String appenderName) throws Exception
Description: Clears all the logs for a particular appender
Return Type: Null
Parameters:
-
appenderName: Name of the appender
Removing Appenders
Syntax:
void removeAppender(String name)
Description: Removes any registered appender with this logger
Return Type: Null
Parameters:
-
name: Name of the appender
Listing Appenders
Syntax:
HashMap listAllAppenders()
Description: Lists all the registered Appenders
Return Type: HashMap with key as Name of the appender and Value as the corresponding Appender Config.
Parameters: No parameters required.
Fetching Details of Appenders
Syntax:
HashMap fetchAppenderDetails(String appenderName)
Description: Fetches the details of a particular appender
Return Type: HashMap with Name as the property of the AppenderConfig and Value as the property Value
Parameters:
-
appenderName: Name of the appender
Fetching Logs
Syntax:
String fetchLogString(String appenderName, int fileNo) throws FioranoException
Description: Fetch logs from the given file No for given File Appender
Return Type: Logs Present in the given file No.
Parameters:
-
appenderName ? name of the appender
-
fileNo ? Number of the file
Syntax:
String fetchLogString(String appenderName, int fileNo, int startIndex, int lastIndex) throws FioranoException
Description: Fetch the out logs from the given file No for given File Appender within specified indexes
Return Type: Logs Present in the given file number within the indexes specified.
Parameters:
-
appenderName ? Name of the appender
-
fileNo ? Number of the file
-
startIndex ? Starting Index
-
lastIndex ? Last Index
Syntax:
int logFilesCount(String appenderName) throws FioranoException
Description: Gets the no of files used for logging by given File Appender
Return Type: Number of files used.
Parameters:
-
appenderName ? name of the appender
LogLevel
The MBean should be initialized by the following string representation of the object name.
Syntax:
Fiorano.Loggers:ServiceType=Logger,Name=%LoggerName%,type=config
Description: level of logging. No log event will be generated for logging statement above this level.
Type: int
Access: RW
Default Value: -1