## org.eclipse.datatools.connectivity.oda.util.logging
Class StreamHandler

    java.lang.Object
      org.eclipse.datatools.connectivity.oda.util.logging.Handler
          org.eclipse.datatools.connectivity.oda.util.logging.StreamHandler

Direct Known Subclasses:
  FileHandler

    public class StreamHandler

extends Handler

`StreamHandler` is a stream based logging `Handler`.

Constructor Summary
`StreamHandler()` Creates a `StreamHandler` with no output stream.
`StreamHandler(java.io.OutputStream output, LogFormatter formatter)` Creates a `StreamHandler` with the specified output stream and `LogFormatter`.

Method Summary
`void` `close()` Closes the current output stream.
`void` `flush()` Flushes buffered message to the output stream.
`boolean` `isLoggable(LogRecord record)` Checks if this `StreamHandler` has an associated `OutputStream`, whether the `LogRecord` has the adequate log level, and whether it satisfies the associated `Filter`.
`void` `publish(LogRecord record)` Format and publish the specified `LogRecord`.
`void` `setFormatter(LogFormatter formatter)` Sets the `LogFormatter` for this `StreamHandler`.

Methods inherited from class org.eclipse.datatools.connectivity.oda.util.logging.Handler
`getFilter, getFormatter, getLevel, getLoggingErrorHandler, setFilter, setLevel, setLoggingErrorHandler`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StreamHandler

    public StreamHandler()

  Creates a `StreamHandler` with no output stream.

### StreamHandler

    public StreamHandler(java.io.OutputStream output,
                         LogFormatter formatter)

  Creates a `StreamHandler` with the specified output stream and `LogFormatter`.

  Parameters:
    `output` - the output stream.
    `formatter` - the log formatter.

Method Detail

### close

    public void close()

  Closes the current output stream.

  Specified by:
    `close` in class `Handler`

### flush

    public void flush()

  Flushes buffered message to the output stream.

  Specified by:
    `flush` in class `Handler`

### publish

    public void publish(LogRecord record)

  Format and publish the specified `LogRecord`. This first checks that there is an associated `OutputStream` and the specified `LogRecord` has the required log level. This also checks the `LogRecord` with the associated `Filter` to see if the record should be published. Then this uses its `LogFormatter` to format the record and publishes the result to the `OutputStream`.

  Specified by:
    `publish` in class `Handler`
  Parameters:
    `record` - the `LogRecord` to format and publish.

### isLoggable

    public boolean isLoggable(LogRecord record)

  Checks if this `StreamHandler` has an associated `OutputStream`, whether the `LogRecord` has the adequate log level, and whether it satisfies the associated `Filter`.

  Overrides:
    `isLoggable` in class `Handler`
  Parameters:
    `record` - the `LogRecord` to check.
  Returns:
    true if the `LogRecord` should be logged.

### setFormatter

    public void setFormatter(LogFormatter formatter)

  Sets the `LogFormatter` for this `StreamHandler`. If the formatter is `null`, then default `SimpleFormatter` will be used.

  Overrides:
    `setFormatter` in class `Handler`
  Parameters:
    `formatter` - the formatter to set.