diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java index ffa4c6273..189c1e50d 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java @@ -305,7 +305,7 @@ public void publish(LogRecord record) { } LogEntry logEntry; try { - logEntry = logEntryFor(record); + logEntry = logEntryFor(record).build(); } catch (Exception ex) { getErrorManager().error(null, ex, ErrorManager.FORMAT_FAILURE); return; @@ -343,7 +343,7 @@ private MonitoredResource getMonitoredResource() { return null; } - private LogEntry logEntryFor(LogRecord record) throws Exception { + protected LogEntry.Builder logEntryFor(LogRecord record) throws Exception { String payload = getFormatter().format(record); Level level = record.getLevel(); LogEntry.Builder builder = @@ -360,7 +360,7 @@ private LogEntry logEntryFor(LogRecord record) throws Exception { for (LoggingEnhancer enhancer : enhancers) { enhancer.enhanceLogEntry(builder); } - return builder.build(); + return builder; } @Override