Class LoggingInterceptor
- java.lang.Object
-
- java.util.logging.Handler
-
- com.google.cloud.hadoop.util.interceptors.LoggingInterceptor
-
-
Constructor Summary
Constructors Constructor Description LoggingInterceptor(com.google.auth.oauth2.GoogleCredentials credentials, String logNameSuffix)Constructs a newLoggingInterceptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the Google Cloud Logging service.protected com.google.cloud.logging.LoggingcreateLoggingService(com.google.auth.oauth2.GoogleCredentials credentials)Creates a Google Cloud Logging service instance.voidflush()Flushes any buffered log entries to Google Cloud Logging.voidpublish(LogRecord record)Publishes a log record to Google Cloud Logging.-
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
-
-
-
Constructor Detail
-
LoggingInterceptor
public LoggingInterceptor(com.google.auth.oauth2.GoogleCredentials credentials, String logNameSuffix)Constructs a newLoggingInterceptor.- Parameters:
credentials- the Google Cloud credentials used to authenticate with the Logging servicelogNameSuffix- the suffix to append to the log name
-
-
Method Detail
-
createLoggingService
protected com.google.cloud.logging.Logging createLoggingService(com.google.auth.oauth2.GoogleCredentials credentials)
Creates a Google Cloud Logging service instance.- Parameters:
credentials- the Google Cloud credentials used to authenticate with the Logging service- Returns:
- a
Logginginstance
-
publish
public void publish(LogRecord record)
Publishes a log record to Google Cloud Logging.
-
flush
public void flush()
Flushes any buffered log entries to Google Cloud Logging.
-
close
public void close() throws SecurityExceptionCloses the Google Cloud Logging service.- Specified by:
closein classHandler- Throws:
SecurityException- if an error occurs while closing the service
-
-