cz.cuni.amis.pogamut.base.utils.logging
Interface IAgentLogger

All Superinterfaces:
IJMXAgentLogger, IJMXEnabled
All Known Implementing Classes:
AbstractAgentLogger, AgentLogger, AgentLoggerJMXProxy

public interface IAgentLogger
extends IJMXAgentLogger, IJMXEnabled

Basic interface for agent's logs.


Method Summary
 void addDefaultConsoleHandler()
          Adds console handler to every existing LogCategory plus to every new one.
 java.util.logging.Handler addDefaultFileHandler(java.io.File file)
          Adds console handler to every existing LogCategory plus to every new one.
 void addDefaultHandler(java.util.logging.Handler handler)
          Adds handler to every existing LogCategory plus to every new one.
 void addDefaultNetworkHandler()
          Adds network handler to every existing LogCategory plus to every new one.
 java.util.logging.Handler addDefaultPublisher(ILogPublisher publisher)
          Adds publisher to every existing LogCategory plus to every new one.
 void addToAllCategories(java.util.logging.Handler handler)
          Adds new handler to all categories.
 void addToAllCategories(ILogPublisher logPublisher)
          Adds new publisher to all categories.
 IAgentId getAgentId()
          Returns agent name.
 java.util.Map<java.lang.String,LogCategory> getCategories()
          Return immutable map of all log categories.
 LogCategory getCategory(IComponent component)
          Returns LogCategory for specified IComponent.
 LogCategory getCategory(java.lang.String name)
          Returns LogCategory for specified name.
 java.util.logging.Handler getDefaultConsoleHandler()
          Returns Handler that provides console publishing of all logs.
 java.util.logging.Handler getDefaultNetworkHandler()
          Returns Handler that provides publishing of all logs through NetworkLogPublisher.
 java.lang.String getNetworkLoggerHost()
          Returns a host where NetworkLogManager is listening.
 java.lang.Integer getNetworkLoggerPort()
          Returns port where NetworkLogManager is listening.
 boolean isDefaultConsoleHandler()
          Tells whether the logger has default console handler attached.
 boolean isDefaultNetworkHandler()
          Tells whether the logger has default network handler attached.
 void removeDefaultConsoleHandler()
          Removes default console handler from every existing LogCategory.
 void removeDefaultHandler(java.util.logging.Handler handler)
          Removes default handler from all existing LogCategory.
 void removeDefaultNetworkHandler()
          Removes default network handler from every existing LogCategory.
 void removeFromAllCategories(java.util.logging.Handler handler)
          Removes a handler from all categories.
 void setLevel(java.util.logging.Level newLevel)
          Set level for all handlers of all categories.
 
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.jmx.IJMXEnabled
enableJMX
 

Method Detail

getAgentId

IAgentId getAgentId()
Returns agent name.

Returns:

getNetworkLoggerPort

java.lang.Integer getNetworkLoggerPort()
Returns port where NetworkLogManager is listening.

Returns null if network logging is not enabled.

Specified by:
getNetworkLoggerPort in interface IJMXAgentLogger
Returns:

getNetworkLoggerHost

java.lang.String getNetworkLoggerHost()
Returns a host where NetworkLogManager is listening.

Returns null if network logging is not enabled.

Specified by:
getNetworkLoggerHost in interface IJMXAgentLogger
Returns:

getCategory

LogCategory getCategory(IComponent component)
Returns LogCategory for specified IComponent.

Parameters:
component -
Returns:

getCategory

LogCategory getCategory(java.lang.String name)
Returns LogCategory for specified name. If category with this name doesn't exist new is created.

Parameters:
name -
Returns:

getCategories

java.util.Map<java.lang.String,LogCategory> getCategories()
Return immutable map of all log categories. You have to synchronize on it before iterating through its elements.

Does not contain agent logger itself.

Returns:

addDefaultConsoleHandler

void addDefaultConsoleHandler()
Adds console handler to every existing LogCategory plus to every new one.

Shortcut for quick usage.


getDefaultConsoleHandler

java.util.logging.Handler getDefaultConsoleHandler()
Returns Handler that provides console publishing of all logs.

May return null in case that console logging is not enabled on the logger, i.e., you have to call addDefaultConsoleHandler().

Returns:

removeDefaultConsoleHandler

void removeDefaultConsoleHandler()
Removes default console handler from every existing LogCategory.


isDefaultConsoleHandler

boolean isDefaultConsoleHandler()
Tells whether the logger has default console handler attached.

Returns:

addDefaultNetworkHandler

void addDefaultNetworkHandler()
Adds network handler to every existing LogCategory plus to every new one.

Enables utilization of NetworkLogManager for publishing all logs of this logger.

Specified by:
addDefaultNetworkHandler in interface IJMXAgentLogger

getDefaultNetworkHandler

java.util.logging.Handler getDefaultNetworkHandler()
Returns Handler that provides publishing of all logs through NetworkLogPublisher.

May return null in case that network logging is not enabled on the logger, i.e., you have to call addDefaultNetworkHandler().

Returns:

removeDefaultNetworkHandler

void removeDefaultNetworkHandler()
Removes default network handler from every existing LogCategory.

Note that this method is automatically called whenever the AbstractAgent is stopped/killed.

Specified by:
removeDefaultNetworkHandler in interface IJMXAgentLogger

isDefaultNetworkHandler

boolean isDefaultNetworkHandler()
Tells whether the logger has default network handler attached.

It allows you to query whether the agent logger is outputting its logs to the NetworkLogManager or not.

Specified by:
isDefaultNetworkHandler in interface IJMXAgentLogger
Returns:

addDefaultFileHandler

java.util.logging.Handler addDefaultFileHandler(java.io.File file)
Adds console handler to every existing LogCategory plus to every new one.

Shortcut for quick usage.

Returns:
new added handler

addDefaultPublisher

java.util.logging.Handler addDefaultPublisher(ILogPublisher publisher)
Adds publisher to every existing LogCategory plus to every new one.

Parameters:
publisher -
Returns:
newly added handler

addDefaultHandler

void addDefaultHandler(java.util.logging.Handler handler)
Adds handler to every existing LogCategory plus to every new one.

Parameters:
handler -

removeDefaultHandler

void removeDefaultHandler(java.util.logging.Handler handler)
Removes default handler from all existing LogCategory.

Parameters:
handler -

addToAllCategories

void addToAllCategories(ILogPublisher logPublisher)
Adds new publisher to all categories.

Parameters:
logPublisher -

addToAllCategories

void addToAllCategories(java.util.logging.Handler handler)
Adds new handler to all categories.

Parameters:
handler -

removeFromAllCategories

void removeFromAllCategories(java.util.logging.Handler handler)
Removes a handler from all categories.

Parameters:
handler -

setLevel

void setLevel(java.util.logging.Level newLevel)
Set level for all handlers of all categories.

Parameters:
newLevel -