public class JMXLogCategories extends Object implements ILogCategories, JMXLogCategoriesMBean
| Modifier and Type | Field and Description |
|---|---|
protected ILogCategories |
logCategories
Wrapped categories we're decorating.
|
protected MBeanServer |
mBeanServer
MBean server for the log categories.
|
protected ObjectName |
objectName
Id of the MBean.
|
| Constructor and Description |
|---|
JMXLogCategories(ILogCategories logCategories,
MBeanServer mBeanServer,
ObjectName parent)
JMXLogCategories differs from LogCategories by implicit handler with JMXLogPublisher in every
log category it produces.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLogCategory(String name,
LogCategory category)
Adds log category from outside of the object.
|
Map<String,LogCategory> |
getCategories()
Returns IMMUTABLE mapping of categories names to instances of those log categories.
|
LogCategory |
getCategory(String name)
Returns existing category by the name or adds new one.
|
String[] |
getCategoryNames()
Returns names of all existing log categories.
|
String[] |
getCategoryNamesSorted()
Returns names of all existing log categories sorted alphabetically.
|
ObjectName |
getJMXLogCategoriesName()
Returns actual JMX object name for this object.
|
static ObjectName |
getJMXLogCategoriesName(ObjectName parent)
Gets LogCategories's object name given parent's name.
|
static ObjectName |
getJMXLogCategoryName(ObjectName parent,
String categoryName) |
ObjectName |
getJMXLogCategoryName(String categoryName)
Returns jmx name for the specified category name (obtained from getCategoryNames()).
|
boolean |
hasCategory(String name)
Whether some category with specified name exists.
|
void |
setLevel(Level newLevel)
Set level for all handlers of all categories.
|
protected ILogCategories logCategories
protected MBeanServer mBeanServer
protected ObjectName objectName
public JMXLogCategories(ILogCategories logCategories, MBeanServer mBeanServer, ObjectName parent) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, MalformedObjectNameException, NullPointerException
Can't be instantiated twice for one (JMX Domain,mBeanServer)!
logCategories - mBeanServer - parent - InstanceAlreadyExistsException - raised if instantiated twice for one jmx domainMBeanRegistrationExceptionNotCompliantMBeanExceptionMalformedObjectNameExceptionNullPointerExceptionpublic LogCategory getCategory(String name)
Contains handler with JMXLogPublisher attached.
If you wish to add another handler do: LogCategory myCategory = categories.getCategory("my log"); // create new category myCategory.newHandler(new LogPublisher.ConsolePublisher()); // add new handler with output to the console
getCategory in interface ILogCategoriesname - public Map<String,LogCategory> getCategories()
ILogCategories
It does not contain instance of IAgentLogger.
getCategories in interface ILogCategoriespublic String[] getCategoryNames()
ILogCategoriesgetCategoryNames in interface ILogCategoriesgetCategoryNames in interface JMXLogCategoriesMBeanpublic String[] getCategoryNamesSorted()
ILogCategoriesgetCategoryNamesSorted in interface ILogCategoriesgetCategoryNamesSorted in interface JMXLogCategoriesMBeanpublic boolean hasCategory(String name)
ILogCategorieshasCategory in interface ILogCategoriespublic void setLevel(Level newLevel)
ILogCategoriessetLevel in interface ILogCategoriessetLevel in interface JMXLogCategoriesMBeanpublic void addLogCategory(String name, LogCategory category)
ILogCategoriesaddLogCategory in interface ILogCategoriespublic ObjectName getJMXLogCategoryName(String categoryName) throws PogamutJMXNameException
JMXLogCategoriesMBeangetJMXLogCategoryName in interface JMXLogCategoriesMBeanPogamutJMXNameExceptionpublic static ObjectName getJMXLogCategoryName(ObjectName parent, String categoryName) throws PogamutJMXNameException
PogamutJMXNameExceptionpublic ObjectName getJMXLogCategoriesName()
JMXLogCategoriesMBeangetJMXLogCategoriesName in interface JMXLogCategoriesMBeanpublic static ObjectName getJMXLogCategoriesName(ObjectName parent) throws PogamutJMXNameException
parent - PogamutJMXNameExceptionCopyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.