diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b91fa381f..4dd9974f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -104,7 +104,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: temurin - java-version: 11 + java-version: 17 - run: java -version - run: .kokoro/build.sh env: diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml index d74a2b264..667eb33ae 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.47.0 + uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.48.0 with: bom-path: pom.xml diff --git a/.kokoro/build.sh b/.kokoro/build.sh index aec02e75e..33ce37cb8 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -52,7 +52,7 @@ test) RETURN_CODE=$? ;; lint) - mvn com.coveo:fmt-maven-plugin:check -B -ntp + mvn com.spotify.fmt:fmt-maven-plugin:check -B -ntp RETURN_CODE=$? ;; javadoc) diff --git a/.kokoro/presubmit/graalvm-native-a.cfg b/.kokoro/presubmit/graalvm-native-a.cfg index a40d327c5..838457874 100644 --- a/.kokoro/presubmit/graalvm-native-a.cfg +++ b/.kokoro/presubmit/graalvm-native-a.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.47.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.48.0" } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native-b.cfg b/.kokoro/presubmit/graalvm-native-b.cfg index f8ab2d6e5..af1210bdc 100644 --- a/.kokoro/presubmit/graalvm-native-b.cfg +++ b/.kokoro/presubmit/graalvm-native-b.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.47.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.48.0" } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native-c.cfg b/.kokoro/presubmit/graalvm-native-c.cfg index 801ef99f4..8005646fc 100644 --- a/.kokoro/presubmit/graalvm-native-c.cfg +++ b/.kokoro/presubmit/graalvm-native-c.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_c:3.47.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.48.0" } env_vars: { diff --git a/CHANGELOG.md b/CHANGELOG.md index be92576c6..72be585e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog +## [0.132.8-alpha](https://github.com/googleapis/java-logging-logback/compare/v0.132.7-alpha...v0.132.8-alpha) (2025-05-20) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-logging to v3.22.4 ([#1477](https://github.com/googleapis/java-logging-logback/issues/1477)) ([d1852aa](https://github.com/googleapis/java-logging-logback/commit/d1852aa2ff5af397c52e9950a0fbcae3e6575122)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.48.0 ([#1474](https://github.com/googleapis/java-logging-logback/issues/1474)) ([ce8b356](https://github.com/googleapis/java-logging-logback/commit/ce8b3560c963dc5b96bd76ff0f86175b794b4332)) +* Update dependency org.easymock:easymock to v5.6.0 ([#1475](https://github.com/googleapis/java-logging-logback/issues/1475)) ([84827c3](https://github.com/googleapis/java-logging-logback/commit/84827c34e35a9e14b04e5c7223bd8bca5070893d)) + ## [0.132.7-alpha](https://github.com/googleapis/java-logging-logback/compare/v0.132.6-alpha...v0.132.7-alpha) (2025-05-06) diff --git a/README.md b/README.md index de2fab9b8..7b14f4198 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,36 @@ public class TestLogger { } ``` +### Controlling the batching settings +When using asynchronous logging, the Logging API is called asynchronously. This allows the appender +to combine multiple `write()` calls into a single, more efficient request to the Logging API. The +`logbackBatchingSettings` in the `logback.xml` file configures the batching behavior: + +``` + + 100 + 1000 + 500 + 10000 + 100000 + Ignore + +``` +Here are some explanations for [BatchingSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.batching.BatchingSettings): +* `elementCountThreshold`: Triggers a `writeLogEntries` request when the number of batched log entries exceeds this threshold. +* `requestByteThreshold`: Triggers a `writeLogEntries` request when the total size of batched log entries (in bytes) exceeds this threshold. +* `delayThreshold`: Triggers a `writeLogEntries` request when the threshold in milliseconds has passed since the first log entry created the batch. + +Batching also supports [FlowControl](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.batching.FlowControlSettings), which can be used to +prevent the batching implementation from accumulating messages without limit, resulting eventually in an OutOfMemory exception. These settings in the configuration controls +flow control behavior: + +* `maxOutstandingElementCount`: When the total number of outstanding log events exceeds this threshold, flow control will be initiated. +* `maxOutstandingRequestBytes`: When the total size of outstanding `writeLogEntries` requests exceeds this threshold, flow control will be initiated. +* `limitExceededBehavior`: This value defines what action the appender should take when the configured limits (like `maxOutstandingRequestBytes` or `maxOutstandingElementCount`) are exceeded. + +For more information about batching configurations, see [BatchingSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.batching.BatchingSettings). + ### Populate log entries with metadata The library provides multiple ways to enrich log entries with additional information. diff --git a/pom.xml b/pom.xml index f9ca8d034..ac7953a3e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 google-cloud-logging-logback - 0.132.7-alpha + 0.132.8-alpha jar Google Cloud Logging Logback Appender https://github.com/googleapis/java-logging-logback @@ -15,9 +15,9 @@ 1.2.13 - 5.5.0 + 5.6.0 1.4.4 - 3.22.3 + 3.22.4 1.7.36 1.10.1 @@ -25,7 +25,7 @@ com.google.cloud sdk-platform-java-config - 3.47.0 + 3.48.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 2f1f7c9e0..80ec441a7 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-logging-logback - 0.132.7-alpha + 0.132.8-alpha 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 aa0931401..27d7c6e2d 100644 --- a/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java +++ b/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java @@ -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.7-alpha"; + public static final String DEFAULT_INSTRUMENTATION_VERSION = "0.132.8-alpha"; // {x-version-update-end} private static boolean instrumentationAdded = false; private static final Object instrumentationLock = new Object(); @@ -538,19 +538,19 @@ static void writeStack(IThrowableProxy throwProxy, String prefix, StringBuilder */ private static Severity severityFor(Level level) { switch (level.toInt()) { - // TRACE + // TRACE case 5000: return Severity.DEBUG; - // DEBUG + // DEBUG case 10000: return Severity.DEBUG; - // INFO + // INFO case 20000: return Severity.INFO; - // WARNING + // WARNING case 30000: return Severity.WARNING; - // ERROR + // ERROR case 40000: return Severity.ERROR; default: diff --git a/versions.txt b/versions.txt index 11d7c0684..e53b9cfb8 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-logging-logback:0.132.7-alpha:0.132.7-alpha +google-cloud-logging-logback:0.132.8-alpha:0.132.8-alpha