public class DataflowWorkerLoggingHandler extends Handler
LogRecord into JSON format for Cloud Logging.
Any exception is represented using Throwable.printStackTrace().| Constructor and Description |
|---|
DataflowWorkerLoggingHandler(OutputStream output)
Constructs a handler that writes to an arbitrary output stream.
|
DataflowWorkerLoggingHandler(String fileName)
Constructs a handler that writes to a file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
static String |
formatException(Throwable thrown)
Formats the throwable as per
Throwable.printStackTrace(). |
boolean |
isLoggable(LogRecord record)
Check if a LogRecord will be logged.
|
void |
publish(LogRecord record) |
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevelpublic DataflowWorkerLoggingHandler(String fileName) throws IOException
IOExceptionpublic DataflowWorkerLoggingHandler(OutputStream output) throws IOException
IOExceptionpublic static String formatException(Throwable thrown)
Throwable.printStackTrace().thrown - The throwable to format.Throwable.printStackTrace().public boolean isLoggable(LogRecord record)
This method checks if the LogRecord has an appropriate level and whether it satisfies any Filter. It will also return false if the handler has been closed, or the LogRecord is null.
isLoggable in class Handler