org.esa.beam.util.logging
Class CacheHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.esa.beam.util.logging.CacheHandler

public class CacheHandler
extends Handler

This class is a special message handle that caches all logging messages in memory for later use. It is needed in most beam alpplications, when the logging starts before the user defined logging files are selected.


Constructor Summary
CacheHandler()
          Constructs the object with default parameter.
 
Method Summary
 void close()
          Close the Handler and free all associated resources.
 void flush()
          Removes all records from the vector.
 void publish(LogRecord record)
          Publish a LogRecord.
 void transferRecords(Handler target)
          Transfers all logging records chached to the handler passed in.
 
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
 

Constructor Detail

CacheHandler

public CacheHandler()
Constructs the object with default parameter.

Method Detail

publish

public void publish(LogRecord record)
Publish a LogRecord.

The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

The Handler is responsible for formatting the message, when and if necessary. The formatting should include localization.

Specified by:
publish in class Handler
Parameters:
record - description of the logging event

flush

public void flush()
Removes all records from the vector.

Specified by:
flush in class Handler

close

public void close()
           throws SecurityException
Close the Handler and free all associated resources.

The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.

Specified by:
close in class Handler
Throws:
SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control").

transferRecords

public void transferRecords(Handler target)
Transfers all logging records chached to the handler passed in.

Parameters:
target - the target handler to publish the cache content


Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.