Skip to content

Commit a233647

Browse files
authored
chore: fix auto-population monitored resource (#657)
to allow unit testing to customize the logic auto-population should be skipped if monotored resource is set.
1 parent cceb48d commit a233647

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/main/java/com/google/cloud/logging/logback/LoggingAppender.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,8 @@ public Synchronicity getWriteSynchronicity() {
233233
}
234234

235235
private void setupMonitoredResource() {
236-
if (autoPopulateMetadata) {
236+
if (monitoredResource == null && autoPopulateMetadata) {
237237
monitoredResource = MonitoredResourceUtil.getResource(getProjectId(), resourceType);
238-
} else {
239-
monitoredResource = null;
240238
}
241239
}
242240

0 commit comments

Comments
 (0)