cz.cuni.amis.pogamut.base.utils.logging
Class LogCategory

java.lang.Object
  extended by java.util.logging.Logger
      extended by cz.cuni.amis.pogamut.base.utils.logging.LogCategory
All Implemented Interfaces:
java.lang.Comparable<LogCategory>
Direct Known Subclasses:
LogCategoryJMXProxy

public class LogCategory
extends java.util.logging.Logger
implements java.lang.Comparable<LogCategory>

Instance that serves as a gateway for your log messages.

The trick with categories is that every log record may contain object parameters. So we're appending instance of this class as a very first parameter to the log record and filter those messages according to them.


Field Summary
 
Fields inherited from class java.util.logging.Logger
global, GLOBAL_LOGGER_NAME
 
Constructor Summary
LogCategory(java.lang.String categoryName)
           
LogCategory(java.lang.String categoryName, java.util.logging.Logger parent)
           
 
Method Summary
 LogCategory addConsoleHandler()
          Adds default console handler with 'Platform' (== platform logging) agent id.
 LogHandler addHandler()
          Returns new LogHandler with null ILogPublisher that is appended to the logger and filters log messages for this category.
 LogHandler addHandler(ILogPublisher publisher)
          Returns new LogHandler with specified ILogPublisher that is appended to the logger and filters log messages for this category.
 LogEventMark addLogEvent(java.util.logging.Level level, java.lang.String text)
          Add new log event to the log, event won't end, until removed using LogCategory#removeLogEvent(java.lang.Object) .
 void addLogEvent(java.util.logging.Level level, java.lang.String text, long duration)
          Add new log event to the log, the event starts now.
 void addLogMessage(java.util.logging.Level level, java.lang.String text)
          Add log message to the log.
 LogMapMark addMapMark(java.util.logging.Level level, java.lang.String msg, Location location)
          Add mark to the map.
 void addMapMark(java.util.logging.Level level, java.lang.String msg, Location location, long duration)
          Add mark to the map for specified time and add notice to the logs.
 int compareTo(LogCategory o)
           
 void fine(java.lang.String msg)
           
 void fine(java.lang.String msg, java.lang.Object param)
           
 void fine(java.lang.String msg, java.lang.Object[] params)
           
 void finer(java.lang.String msg)
           
 void finer(java.lang.String msg, java.lang.Object param)
           
 void finer(java.lang.String msg, java.lang.Object[] params)
           
 void finest(java.lang.String msg)
           
 void finest(java.lang.String msg, java.lang.Object param)
           
 void finest(java.lang.String msg, java.lang.Object[] params)
           
 java.lang.String getCategoryName()
           
 void info(java.lang.String msg)
           
 void info(java.lang.String msg, java.lang.Object param)
           
 void info(java.lang.String msg, java.lang.Object[] params)
           
 void log(java.util.logging.Level level, java.lang.String msg)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object param)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object[] params)
          All other logging methods is calling this one.
 void removeLogEvent(LogEventMark mark)
          Remove log event with undefined duration.
 void removeMapMark(LogMapMark mark)
          Remove mark from the map.
 void setLevel(java.util.logging.Level logLevel)
           
 void severe(java.lang.String msg)
           
 void severe(java.lang.String msg, java.lang.Object param)
           
 void severe(java.lang.String msg, java.lang.Object[] params)
           
 java.lang.String toString()
           
 void warning(java.lang.String msg)
           
 void warning(java.lang.String msg, java.lang.Object param)
           
 void warning(java.lang.String msg, java.lang.Object[] params)
           
 
Methods inherited from class java.util.logging.Logger
addHandler, config, entering, entering, entering, exiting, exiting, getAnonymousLogger, getAnonymousLogger, getFilter, getHandlers, getLevel, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers, isLoggable, log, log, logp, logp, logp, logp, logrb, logrb, logrb, logrb, removeHandler, setFilter, setParent, setUseParentHandlers, throwing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogCategory

public LogCategory(java.lang.String categoryName)

LogCategory

public LogCategory(java.lang.String categoryName,
                   java.util.logging.Logger parent)
Method Detail

getCategoryName

public java.lang.String getCategoryName()

setLevel

public void setLevel(java.util.logging.Level logLevel)
              throws java.lang.SecurityException
Overrides:
setLevel in class java.util.logging.Logger
Throws:
java.lang.SecurityException

addConsoleHandler

public LogCategory addConsoleHandler()
Adds default console handler with 'Platform' (== platform logging) agent id.

Use only when using LogCategory separately, i.e., outside IAgentLogger.

Returns:
this instance

addHandler

public LogHandler addHandler()
Returns new LogHandler with null ILogPublisher that is appended to the logger and filters log messages for this category.

The handler will use LogPublisher.ConsolePublisher as default.

This is the quickest way to obtain new output from the log.

Returns:

addHandler

public LogHandler addHandler(ILogPublisher publisher)
Returns new LogHandler with specified ILogPublisher that is appended to the logger and filters log messages for this category.

The handler will use LogPublisher.ConsolePublisher as default.

This is the quickest way to obtain new output from the log.

Returns:

log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Object[] params)
All other logging methods is calling this one. Synchronized!

Overrides:
log in class java.util.logging.Logger

log

public void log(java.util.logging.Level level,
                java.lang.String msg)
Overrides:
log in class java.util.logging.Logger

log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Object param)
Overrides:
log in class java.util.logging.Logger

finest

public void finest(java.lang.String msg)
Overrides:
finest in class java.util.logging.Logger

finest

public void finest(java.lang.String msg,
                   java.lang.Object param)

finest

public void finest(java.lang.String msg,
                   java.lang.Object[] params)

finer

public void finer(java.lang.String msg)
Overrides:
finer in class java.util.logging.Logger

finer

public void finer(java.lang.String msg,
                  java.lang.Object param)

finer

public void finer(java.lang.String msg,
                  java.lang.Object[] params)

fine

public void fine(java.lang.String msg)
Overrides:
fine in class java.util.logging.Logger

fine

public void fine(java.lang.String msg,
                 java.lang.Object param)

fine

public void fine(java.lang.String msg,
                 java.lang.Object[] params)

info

public void info(java.lang.String msg)
Overrides:
info in class java.util.logging.Logger

info

public void info(java.lang.String msg,
                 java.lang.Object param)

info

public void info(java.lang.String msg,
                 java.lang.Object[] params)

warning

public void warning(java.lang.String msg)
Overrides:
warning in class java.util.logging.Logger

warning

public void warning(java.lang.String msg,
                    java.lang.Object param)

warning

public void warning(java.lang.String msg,
                    java.lang.Object[] params)

severe

public void severe(java.lang.String msg)
Overrides:
severe in class java.util.logging.Logger

severe

public void severe(java.lang.String msg,
                   java.lang.Object param)

severe

public void severe(java.lang.String msg,
                   java.lang.Object[] params)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(LogCategory o)
Specified by:
compareTo in interface java.lang.Comparable<LogCategory>

addMapMark

public void addMapMark(java.util.logging.Level level,
                       java.lang.String msg,
                       Location location,
                       long duration)
Add mark to the map for specified time and add notice to the logs.

Parameters:
level - What level is this mark? If too low, it can be filtered out.
msg - What text should be shown on the map at the specified place.
location - Location, where should be mark placed. If null, mark will follow the agent.
duration - How long should be mark shown? In ms.

addMapMark

public LogMapMark addMapMark(java.util.logging.Level level,
                             java.lang.String msg,
                             Location location)
Add mark to the map. If you want to remove the mark, use LogCategory#removeMapMark(java.lang.Object)

Parameters:
level - What level is this mark? If too low, it can be filtered out.
msg - What text should be shown on the map at the specified place.
location - Location, where should be mark placed. If null, mark will follow the agent.
Returns:
object that can be later used in LogCategory#removeMapMark(java.lang.Object) in order to remove the mark from the map.

removeMapMark

public void removeMapMark(LogMapMark mark)
Remove mark from the map. Mark should be previosly inserted using addMapMark(java.util.logging.Level, java.lang.String, cz.cuni.amis.pogamut.base3d.worldview.object.Location)

Parameters:
mark - object that was returned by addMapMark(java.util.logging.Level, java.lang.String, cz.cuni.amis.pogamut.base3d.worldview.object.Location) during addition of mark to the map.

addLogMessage

public void addLogMessage(java.util.logging.Level level,
                          java.lang.String text)
Add log message to the log. Log message is log event with zero duration.

Parameters:
text - text of log message.

addLogEvent

public void addLogEvent(java.util.logging.Level level,
                        java.lang.String text,
                        long duration)
Add new log event to the log, the event starts now.

Parameters:
level - level of event.
text - text of event
duration - how long should event last?

addLogEvent

public LogEventMark addLogEvent(java.util.logging.Level level,
                                java.lang.String text)
Add new log event to the log, event won't end, until removed using LogCategory#removeLogEvent(java.lang.Object) .

Parameters:
level - level of event.
text - text of event
Returns:
object that can be later used in LogCategory#removeLogEvent(java.lang.Object) in order to remove the event from the log.

removeLogEvent

public void removeLogEvent(LogEventMark mark)
Remove log event with undefined duration. The event should be created by addLogEvent(java.util.logging.Level, java.lang.String)

Parameters:
mark - object returned by addLogEvent(java.util.logging.Level, java.lang.String) during addition of log event to the log.