diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml index a48787484..7e8b94667 100644 --- a/.github/workflows/unmanaged_dependency_check.yaml +++ b/.github/workflows/unmanaged_dependency_check.yaml @@ -14,6 +14,6 @@ jobs: shell: bash run: .kokoro/build.sh - name: Unmanaged dependency check - uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.43.0 + uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.44.0 with: bom-path: pom.xml diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg index 8d3f11dc4..728751d04 100644 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.43.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.44.0" } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg index f78bafd26..39151469c 100644 --- a/.kokoro/presubmit/graalvm-native.cfg +++ b/.kokoro/presubmit/graalvm-native.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.43.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.44.0" } env_vars: { diff --git a/CHANGELOG.md b/CHANGELOG.md index d60427c22..f81402201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ # Changelog +## [0.132.4-alpha](https://github.com/googleapis/java-logging-logback/compare/v0.132.3-alpha...v0.132.4-alpha) (2025-02-26) + + +### Bug Fixes + +* Fix Appender default flushlevel to be consistent with java-logging ([#1441](https://github.com/googleapis/java-logging-logback/issues/1441)) ([34a9539](https://github.com/googleapis/java-logging-logback/commit/34a95398682235d87145280cd255498baacfd24b)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-logging to v3.21.4 ([#1445](https://github.com/googleapis/java-logging-logback/issues/1445)) ([2f32d9b](https://github.com/googleapis/java-logging-logback/commit/2f32d9bb814a8b648233ca091cd872f935b5dc6a)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.44.0 ([#1444](https://github.com/googleapis/java-logging-logback/issues/1444)) ([fd5204a](https://github.com/googleapis/java-logging-logback/commit/fd5204a32cc85b5513641f627d17c4a0b2fbd177)) + ## [0.132.3-alpha](https://github.com/googleapis/java-logging-logback/compare/v0.132.2-alpha...v0.132.3-alpha) (2025-02-13) diff --git a/README.md b/README.md index c77f62c4d..de2fab9b8 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ See [Logback filters](https://logback.qos.ch/manual/filters.html#thresholdFilter application.log - + WARN @@ -186,7 +186,11 @@ Note that using the structured logging Json format you cannot control the log na The logs will be ingested into the project that hosts the environment where your application is running. The configuration `logDestinationProjectId` will be ignored. - +### Recommended way to ingest logs in Google Cloud managed environments +If your application is running on Google Cloud Environments such as Google Kubernetes Engine, App Engine flexible environment, and Cloud Run functions, it is recommended to use [logging agent](https://cloud.google.com/logging/docs/agent) +to send application logs to Cloud Logging. Logging agents send data written to a file, such as `stdout` or a file, as logs to Cloud Logging. Using logging agents and relying on logging files such as `stdout` and `stderr` will +ensure that application crashes don't break sending logs to your project. It will also reduce complex coding to explicitly handle buffering and retries using client libraries. For a detailed comparison of logging agents and +client libraries, see [Choosing an agent or client libraries](https://cloud.google.com/logging/docs/agent-or-library#choosing). ## Samples diff --git a/pom.xml b/pom.xml index df239c916..de0195735 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 google-cloud-logging-logback - 0.132.3-alpha + 0.132.4-alpha jar Google Cloud Logging Logback Appender https://github.com/googleapis/java-logging-logback @@ -17,7 +17,7 @@ 1.2.13 5.5.0 1.4.4 - 3.21.3 + 3.21.4 1.7.36 1.10.1 @@ -25,7 +25,7 @@ com.google.cloud sdk-platform-java-config - 3.43.0 + 3.44.0 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 2fbe7f2f9..cacb6770e 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-logging-logback - 0.132.2-alpha + 0.132.3-alpha diff --git a/samples/pom.xml b/samples/pom.xml index 6e0c15d5d..20c2f8317 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -13,7 +13,7 @@ com.google.cloud.samples diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index b81b0df12..382175391 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-logging-logback - 0.132.3-alpha + 0.132.4-alpha diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 37a279638..36d0d0cae 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 26.54.0 + 26.55.0 pom import diff --git a/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java b/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java index 30bfdfee4..e1f11526c 100644 --- a/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java +++ b/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java @@ -62,7 +62,7 @@ * <!-- Optional: defaults to {@code "java.log"} --> * <log>application.log</log> * - * <!-- Optional: defaults to {@code "ERROR"} --> + * <!-- Optional: defaults to {@code "OFF"} --> * <flushLevel>WARN</flushLevel> * * <!-- Optional: defaults to {@code ASYNC} --> @@ -122,7 +122,7 @@ public class LoggingAppender extends UnsynchronizedAppenderBase { // See // https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files // {x-version-update-start:google-cloud-logging-logback:current} - public static final String DEFAULT_INSTRUMENTATION_VERSION = "0.132.3-alpha"; + public static final String DEFAULT_INSTRUMENTATION_VERSION = "0.132.4-alpha"; // {x-version-update-end} private static boolean instrumentationAdded = false; private static final Object instrumentationLock = new Object(); @@ -150,7 +150,7 @@ public class LoggingAppender extends UnsynchronizedAppenderBase { /** * Sets a threshold for log severity level to flush all log entries that were batched so far. * - *

Defaults to Error. + *

Defaults to OFF. * * @param flushLevel Logback log level */ @@ -298,7 +298,7 @@ void setupMonitoredResource(MonitoredResource monitoredResource) { } private Level getFlushLevel() { - return (flushLevel != null) ? flushLevel : Level.ERROR; + return (flushLevel != null) ? flushLevel : Level.OFF; } private String getLogName() { diff --git a/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java b/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java index 6cd59f575..9632cf330 100644 --- a/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java +++ b/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java @@ -193,9 +193,15 @@ public void testFlushLevelConfigSupportsFlushLevelOff() { assertThat(foundSeverity).isEqualTo(null); } + @Test + public void testDefaultFlushLevelOff() { + loggingAppender.start(); + Severity foundSeverity = logging.getFlushSeverity(); + assertThat(foundSeverity).isEqualTo(null); + } + @Test public void testFilterLogsOnlyLogsAtOrAboveLogLevel() { - logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); logging.write( capture(capturedArgument), @@ -223,7 +229,6 @@ public void testFilterLogsOnlyLogsAtOrAboveLogLevel() { @Test public void testPartialSuccessOverrideHasExpectedValue() { - logging.setFlushSeverity(Severity.ERROR); Capture logNameArg = Capture.newInstance(); Capture resourceArg = Capture.newInstance(); Capture partialSuccessArg = Capture.newInstance(); @@ -247,7 +252,6 @@ public void testPartialSuccessOverrideHasExpectedValue() { @Test public void testDefaultWriteOptionsHasExpectedDefaults() { - logging.setFlushSeverity(Severity.ERROR); Capture partialSuccessArg = Capture.newInstance(); logging.write( EasyMock.>anyObject(), @@ -266,7 +270,6 @@ public void testDefaultWriteOptionsHasExpectedDefaults() { @Test public void testMdcValuesAreConvertedToLabels() { - logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); logging.write( capture(capturedArgument), @@ -325,7 +328,6 @@ public void testMdcValuesAreConvertedToLabelsWithPassingNullValues() { MDC.put("mdc1", "value1"); MDC.put("mdc2", null); MDC.put("mdc3", "value3"); - logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); logging.write( capture(capturedArgument), @@ -351,7 +353,6 @@ public void testMdcValuesAreConvertedToLabelsWithPassingNullValues() { @Test public void testAddCustomLoggingEventEnhancers() { MDC.put("mdc1", "value1"); - logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); logging.write( capture(capturedArgument), @@ -375,7 +376,6 @@ public void testAddCustomLoggingEventEnhancers() { @Test public void testAddCustomLoggingEnhancer() { - logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); logging.write( capture(capturedArgument), @@ -398,7 +398,6 @@ public void testAddCustomLoggingEnhancer() { @Test @SuppressWarnings("deprecation") public void testFlush() { - logging.setFlushSeverity(Severity.ERROR); logging.write( EasyMock.>anyObject(), anyObject(WriteOption.class), @@ -419,7 +418,6 @@ public void testFlush() { @Test public void testAutoPopulationEnabled() { - logging.setFlushSeverity(Severity.ERROR); Capture> capturedLogEntries = Capture.newInstance(); EasyMock.expect( logging.populateMetadata( @@ -458,7 +456,6 @@ public void testAutoPopulationEnabled() { @Test public void testRedirectToStdoutEnabled() { - logging.setFlushSeverity(Severity.ERROR); EasyMock.expect( logging.populateMetadata( EasyMock.>anyObject(), @@ -503,7 +500,6 @@ public void testRedirectToStdoutDisabled() { public void testFDiagnosticInfoAdded() { LoggingAppender.setInstrumentationStatus(false); Capture> capturedArgument = Capture.newInstance(); - logging.setFlushSeverity(Severity.ERROR); logging.write( capture(capturedArgument), anyObject(WriteOption.class), @@ -547,7 +543,6 @@ public void testFDiagnosticInfoAdded() { @Test public void testFDiagnosticInfoNotAdded() { - logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); logging.write( capture(capturedArgument), diff --git a/src/test/java/com/google/cloud/logging/logback/logback.xml b/src/test/java/com/google/cloud/logging/logback/logback.xml index d0ec77843..66e86e4e7 100644 --- a/src/test/java/com/google/cloud/logging/logback/logback.xml +++ b/src/test/java/com/google/cloud/logging/logback/logback.xml @@ -8,7 +8,7 @@ application.log - + WARN diff --git a/versions.txt b/versions.txt index e2e3dd388..05f2ee119 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-logging-logback:0.132.3-alpha:0.132.3-alpha +google-cloud-logging-logback:0.132.4-alpha:0.132.4-alpha