xmlBlaster 2.2.0 API

org.xmlBlaster.util.log
Class XbNotifyHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.xmlBlaster.util.log.XbNotifyHandler

public class XbNotifyHandler
extends java.util.logging.Handler

Dispatch logging output to registered listeners. As java.util.logging framework supports max. one Filter per Logger/Handler we dispatch it further here.

Note: You may not directly add a Filter to java.util.logging.Logger/Handler as this would destroy our registration.

Setup is done in logging.properties: handlers= java.util.logging.ConsoleHandler, org.xmlBlaster.util.log.XbNotifyHandler

If deploying xmlBlasterClient.jar to tomcat you may edit xmlBlasterClient.jar#logging.properties and remove XbNotifyHandler to avoid a ClassLoaderException

Author:
Marcel Ruff
See Also:
The admin.logging requirement

Field Summary
private  I_LogListener[] allCache
           
private  java.util.Set allListenerSet
           
private  I_LogListener[] emptyArr
           
private  I_LogListener[] errorCache
           
private  java.util.Set errorListenerSet
           
private  boolean hasAllListener
           
private  java.lang.String id
           
private static long instanceCounter
           
private static XbNotifyHandler theXbNotifyHandler
           
private  I_LogListener[] warnCache
           
private  java.util.Set warnListenerSet
           
 
Constructor Summary
XbNotifyHandler()
           
XbNotifyHandler(java.lang.String id)
           
 
Method Summary
 void close()
           
 void flush()
           
 I_LogListener[] getAllListeners()
          Get a snapshot of all listeners.
 I_LogListener[] getErrorListeners()
          Get a snapshot of error listeners.
 java.lang.String getId()
           
 I_LogListener[] getWarnListeners()
          Get a snapshot of warn listeners.
static XbNotifyHandler instance()
           
static void main(java.lang.String[] args)
           
 void publish(java.util.logging.LogRecord record)
           
 boolean register(int level, I_LogListener logNotification)
          Register a listener.
 boolean unregister(int level, I_LogListener logNotification)
          Remove the listener.
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theXbNotifyHandler

private static XbNotifyHandler theXbNotifyHandler

id

private final java.lang.String id

instanceCounter

private static long instanceCounter

errorListenerSet

private java.util.Set errorListenerSet

errorCache

private I_LogListener[] errorCache

warnListenerSet

private java.util.Set warnListenerSet

warnCache

private I_LogListener[] warnCache

allListenerSet

private java.util.Set allListenerSet

allCache

private I_LogListener[] allCache

emptyArr

private final I_LogListener[] emptyArr

hasAllListener

private boolean hasAllListener
Constructor Detail

XbNotifyHandler

public XbNotifyHandler()

XbNotifyHandler

public XbNotifyHandler(java.lang.String id)
Method Detail

instance

public static XbNotifyHandler instance()

close

public void close()
           throws java.lang.SecurityException
Specified by:
close in class java.util.logging.Handler
Throws:
java.lang.SecurityException

flush

public void flush()
Specified by:
flush in class java.util.logging.Handler

publish

public void publish(java.util.logging.LogRecord record)
Specified by:
publish in class java.util.logging.Handler

register

public boolean register(int level,
                        I_LogListener logNotification)
Register a listener. This listener may NOT use logging himself to avoid recursion.
If the given level/logNotification combination is already registered, the call leaves everything unchanged and returns false.

Parameters:
level - to add, Level.SEVERE.intValue() | Level.WARNING.intValue() | Level.ALL.intValue()
logNotification - The interface to send the logging
Returns:
true if the given logNotification is added

unregister

public boolean unregister(int level,
                          I_LogListener logNotification)
Remove the listener.

Parameters:
level - Which levels you want to remove. Level.SEVERE.intValue() | Level.WARNING.intValue() | Level.ALL.intValue()
Returns:
true if the set contained the specified element.

getWarnListeners

public I_LogListener[] getWarnListeners()
Get a snapshot of warn listeners.


getId

public java.lang.String getId()
Returns:
Returns the id.

getErrorListeners

public I_LogListener[] getErrorListeners()
Get a snapshot of error listeners.


getAllListeners

public I_LogListener[] getAllListeners()
Get a snapshot of all listeners.


main

public static void main(java.lang.String[] args)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.