|
JBoss Log Manager 1.3.2.Final-redhat-1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.logging.Handler
org.jboss.logmanager.ExtHandler
public abstract class ExtHandler
An extended logger handler. Use this class as a base class for log handlers which require ExtLogRecord
instances.
Field Summary | |
---|---|
protected Handler[] |
handlers
The sub-handlers for this handler. |
protected static org.jboss.logmanager.AtomicArray<ExtHandler,Handler> |
handlersUpdater
The atomic updater for the handlers field. |
Constructor Summary | |
---|---|
protected |
ExtHandler()
Construct a new instance. |
Method Summary | |
---|---|
void |
addHandler(Handler handler)
Add a sub-handler to this handler. |
protected static void |
checkAccess()
Deprecated. use checkAccess(ExtHandler) |
protected static void |
checkAccess(ExtHandler handler)
Check access. |
Handler[] |
clearHandlers()
A convenience method to atomically get and clear all sub-handlers. |
void |
close()
Close all child handlers. |
void |
disableAccess()
Disable previous access to the object for modifications on the current thread. |
protected void |
doPublish(ExtLogRecord record)
Do the actual work of publication; the record will have been filtered already. |
void |
enableAccess(Object protectKey)
Enable access to the object for modifications on the current thread. |
void |
flush()
Flush all child handlers. |
Handler[] |
getHandlers()
Get a copy of the sub-handlers array. |
boolean |
isAutoFlush()
Determine if this handler will auto-flush. |
boolean |
isEnabled()
Determine if the handler is enabled. |
void |
protect(Object protectionKey)
Protect this object from modifications. |
void |
publish(ExtLogRecord record)
Publish an ExtLogRecord . |
void |
publish(LogRecord record)
|
void |
removeHandler(Handler handler)
Remove a sub-handler from this handler. |
void |
setAutoFlush(boolean autoFlush)
Change the autoflush setting for this handler. |
void |
setEnabled(boolean enabled)
Enables or disables the handler based on the value passed in. |
void |
setEncoding(String encoding)
|
void |
setErrorManager(ErrorManager em)
|
void |
setFilter(Filter newFilter)
|
void |
setFormatter(Formatter newFormatter)
|
Handler[] |
setHandlers(Handler[] newHandlers)
A convenience method to atomically get and replace the sub-handler array. |
void |
setLevel(Level newLevel)
|
void |
unprotect(Object protectionKey)
Allows the object to be modified if the protectionKey matches the key used to protect the object. |
Methods inherited from class java.util.logging.Handler |
---|
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile Handler[] handlers
handlersUpdater
atomic updater. The array
instance should not be modified (treat as immutable).
protected static final org.jboss.logmanager.AtomicArray<ExtHandler,Handler> handlersUpdater
handlers
field.
Constructor Detail |
---|
protected ExtHandler()
Method Detail |
---|
public final void publish(LogRecord record)
publish
in class Handler
public final void publish(ExtLogRecord record)
ExtLogRecord
.
The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.
The ExtHandler
is responsible for formatting the message, when and if necessary. The formatting should
include localization.
record
- the log record to publishprotected void doPublish(ExtLogRecord record)
autoFlush
property is set to true
; if this behavior is to be
preserved in a subclass then this method should be called after the record is physically written.
record
- the log record to publishpublic void addHandler(Handler handler) throws SecurityException
handler
- the handler to add
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
or the handler is protected
.public void removeHandler(Handler handler) throws SecurityException
handler
- the handler to remove
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
or the handler is protected
.public Handler[] getHandlers()
public Handler[] clearHandlers() throws SecurityException
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
or the handler is protected
.public Handler[] setHandlers(Handler[] newHandlers) throws SecurityException
newHandlers
- the new sub-handlers
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
or the handler is protected
.public boolean isAutoFlush()
true
if auto-flush is enabledpublic void setAutoFlush(boolean autoFlush) throws SecurityException
autoFlush
- true
to automatically flush after each write; false otherwise
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
or the handler is protected
.public final void setEnabled(boolean enabled) throws SecurityException
enabled
- true
to enable the handler or false
to disable the handler.
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
or the handler is protected
.public final boolean isEnabled()
true
if the handler is enabled, otherwise false
.public final void protect(Object protectionKey) throws SecurityException
Protectable
protect
in interface Protectable
protectionKey
- the key used to protect the object.
SecurityException
- if the object is already protected.public final void unprotect(Object protectionKey) throws SecurityException
Protectable
protectionKey
matches the key used to protect
the object.
unprotect
in interface Protectable
protectionKey
- the key used to protect the object.
SecurityException
- if the object is protected and the key doesn't match.public final void enableAccess(Object protectKey)
Protectable
enableAccess
in interface Protectable
protectKey
- the key used to protect
modifications.public final void disableAccess()
Protectable
disableAccess
in interface Protectable
@Deprecated protected static void checkAccess() throws SecurityException
checkAccess(ExtHandler)
SecurityException
- if a security manager is installed and the caller does not have the "control" LoggingPermission
protected static void checkAccess(ExtHandler handler) throws SecurityException
handler
- the handler to check access on.
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
or the handler is protected
.public void flush()
flush
in interface Flushable
flush
in class Handler
public void close() throws SecurityException
close
in interface Closeable
close
in class Handler
SecurityException
public void setFormatter(Formatter newFormatter) throws SecurityException
setFormatter
in class Handler
SecurityException
public void setFilter(Filter newFilter) throws SecurityException
setFilter
in class Handler
SecurityException
public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException
setEncoding
in class Handler
SecurityException
UnsupportedEncodingException
public void setErrorManager(ErrorManager em)
setErrorManager
in class Handler
public void setLevel(Level newLevel) throws SecurityException
setLevel
in class Handler
SecurityException
|
JBoss Log Manager 1.3.2.Final-redhat-1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |