From 8886c203ed15e93deeafb22721243b68e7d2cc5b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 10 Jan 2022 03:06:01 +0100 Subject: [PATCH 01/17] build(deps): update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.3.0 (#633) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build(deps): update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.3.0 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: losalex <90795544+losalex@users.noreply.github.com> --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 047090e0d..45a7f48d9 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -53,7 +53,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add-snippets-source diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 0e5eb7779..9f66cd0e6 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -52,7 +52,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add-snippets-source From 0e1d19df946edb4b83c3b223ee17defc3c3cc07f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 02:08:13 +0000 Subject: [PATCH 02/17] chore: release 0.122.10-SNAPSHOT (#638) :robot: I have created a release \*beep\* \*boop\* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 90c336fda..76604794f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 google-cloud-logging-logback - 0.122.9-alpha + 0.122.10-alpha-SNAPSHOT jar Google Cloud Logging Logback Appender https://github.com/googleapis/java-logging-logback diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 9f66cd0e6..a335da085 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-logging-logback - 0.122.9-alpha + 0.122.10-alpha-SNAPSHOT diff --git a/versions.txt b/versions.txt index ec0d91f01..510b70127 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-logging-logback:0.122.9-alpha:0.122.9-alpha +google-cloud-logging-logback:0.122.9-alpha:0.122.10-alpha-SNAPSHOT From 2e582d9eb0d51fc812648989873f47a83538d1bd Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 10 Jan 2022 17:34:51 +0100 Subject: [PATCH 03/17] chore(deps): update dependency com.google.cloud:google-cloud-logging-logback to v0.122.9-alpha (#639) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-logging-logback to v0.122.9-alpha * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- README.md | 6 +++--- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8775649f0..0efd2e138 100644 --- a/README.md +++ b/README.md @@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-logging-logback - 0.122.8-alpha + 0.122.9-alpha ``` If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-logging-logback:0.122.8-alpha' +implementation 'com.google.cloud:google-cloud-logging-logback:0.122.9-alpha' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-logging-logback" % "0.122.8-alpha" +libraryDependencies += "com.google.cloud" % "google-cloud-logging-logback" % "0.122.9-alpha" ``` ## Authentication diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 45a7f48d9..ea2c701f2 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.122.8-alpha + 0.122.9-alpha From e5de531465015ae735e45ee5b6dc52bdd281ee6e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 18:04:14 +0000 Subject: [PATCH 04/17] fix(java): run Maven in plain console-friendly mode (#1301) (#621) --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/build.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 3d2f82824..731a0eb4a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:a4d7b2cfc6a9d6b378a6b2458740eae15fcab28854bd23dad3a15102d2e47c87 + digest: sha256:491a007c6bd6e77f9e9b1bebcd6cdf08a4a4ef2c228c123d9696845204cb685d diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 0c457c72f..5706ec2a8 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -47,15 +47,15 @@ set +e case ${JOB_TYPE} in test) - mvn test -B -Dclirr.skip=true -Denforcer.skip=true + mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true RETURN_CODE=$? ;; lint) - mvn com.coveo:fmt-maven-plugin:check + mvn com.coveo:fmt-maven-plugin:check -B -ntp RETURN_CODE=$? ;; javadoc) - mvn javadoc:javadoc javadoc:test-javadoc + mvn javadoc:javadoc javadoc:test-javadoc -B -ntp RETURN_CODE=$? ;; integration) @@ -71,7 +71,7 @@ integration) ;; graalvm) # Run Unit and Integration Tests with Native Image - mvn -ntp -Pnative -Penable-integration-tests test + mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test RETURN_CODE=$? ;; samples) @@ -104,7 +104,7 @@ samples) fi ;; clirr) - mvn -B -Denforcer.skip=true clirr:check + mvn -B -ntp -Denforcer.skip=true clirr:check RETURN_CODE=$? ;; *) From 035b984eaa4970e6f882ee76495d4ef567efeaf9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 21:28:19 +0000 Subject: [PATCH 05/17] chore(owlbot-java): disable re-writing clirr file in owlbot java post-processor (#1320) (#641) --- .github/.OwlBot.lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 731a0eb4a..20c6ee3c3 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:491a007c6bd6e77f9e9b1bebcd6cdf08a4a4ef2c228c123d9696845204cb685d + digest: sha256:efbfc5e9ff713005a037941f8ebcc0c69cc630e3ad934675ee26868705a30897 From 00b15136acad76416f5e306396c3ded2d40ae1a6 Mon Sep 17 00:00:00 2001 From: Neenu Shaji Date: Mon, 10 Jan 2022 18:58:25 -0500 Subject: [PATCH 06/17] chore: change name to api_shortname in .repo-metadata.json (#644) --- .repo-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index c97065448..3cbb0492c 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,5 +1,5 @@ { - "name": "logging-logback", + "api_shortname": "logging-logback", "name_pretty": "Cloud Logging Logback Appender", "product_documentation": "https://cloud.google.com/logging/docs/setup/java#logback_appender_for", "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-logging-logback/latest/history", From 21fdd3554ed2778075fec62a87176ad5e8a6f391 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 11 Jan 2022 13:52:20 +0100 Subject: [PATCH 07/17] deps: update dependency com.google.cloud:google-cloud-logging to v3.6.0 (#643) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update dependency com.google.cloud:google-cloud-logging to v3.6.0 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76604794f..90a4cd855 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ 1.2.10 3.6 1.1.3 - 3.5.3 + 3.6.0 1.7.32 1.10.1 From 99e679d7dd24687740696a1050e728e0c95ca889 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 18:30:29 +0000 Subject: [PATCH 08/17] chore(java): update variable name to api_shortname in README template (#1323) (#646) --- .github/.OwlBot.lock.yaml | 2 +- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 20c6ee3c3..dddb13b84 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:efbfc5e9ff713005a037941f8ebcc0c69cc630e3ad934675ee26868705a30897 + digest: sha256:7f737996c88586c499f7b0c25294c760f9f5eec092289a0e08d2d3f42a069ebb diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4e3e20cc8..322e4912a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,7 +21,7 @@ If you are still having issues, please include as much information as possible: General, Core, and Other are also allowed as types 2. OS type and version: 3. Java version: -4. logging-logback version(s): +4. version(s): #### Steps to reproduce From c1c5afcf7a4501295e253c663fd4ac05c2fcd339 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 11 Jan 2022 21:11:34 +0100 Subject: [PATCH 09/17] deps: update dependency org.easymock:easymock to v4 (#640) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update dependency org.easymock:easymock to v4 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 90a4cd855..7d0ecbe12 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ 1.2.10 - 3.6 + 4.3 1.1.3 3.6.0 1.7.32 From be16778882c1b8ba44faeb87625985da8035d0dc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 11 Jan 2022 21:27:52 +0100 Subject: [PATCH 10/17] build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.2.5 (#647) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.2.5 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7d0ecbe12..f97305bfb 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ com.google.cloud google-cloud-shared-config - 1.2.4 + 1.2.5 From 1c36ee1dda81c3fb4b9a545337867e678c07fed6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 11 Jan 2022 22:57:36 +0100 Subject: [PATCH 11/17] chore(deps): update dependency com.google.cloud:libraries-bom to v24.2.0 (#648) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:libraries-bom to v24.2.0 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 4b0bb7bf8..c90da86c9 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 24.1.2 + 24.2.0 pom import From eee8612b1744c52f10ed2940b4b7a65478a7197a Mon Sep 17 00:00:00 2001 From: Neenu Shaji Date: Thu, 13 Jan 2022 14:28:11 -0500 Subject: [PATCH 12/17] chore: update release-level in .repo-metadata.json (#653) --- .repo-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 3cbb0492c..9b6be55e3 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/logging/docs/setup/java#logback_appender_for", "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-logging-logback/latest/history", "issue_tracker": "https://issuetracker.google.com/savedsearches/559764", - "release_level": "alpha", + "release_level": "preview", "language": "java", "repo": "googleapis/java-logging-logback", "repo_short": "java-logging-logback", From 87d259fe6453107a71560acb85b62ea30ccdd8ed Mon Sep 17 00:00:00 2001 From: losalex <90795544+losalex@users.noreply.github.com> Date: Fri, 14 Jan 2022 12:01:52 -0800 Subject: [PATCH 13/17] feat: Allow customizing written log entries by exposing parameters via appender configuration (#625) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Allow customizing written log entries by exposing parameters via appender configuration * Add project id override in getLoggingOptions * Add tests * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Expose project ID based resource name support * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Fix comment * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Address PR comments * Fix README * Fix name in README * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Revert version for logback used * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Fix README * Revert 0.122.9-alpha reference * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Add comment to partial README * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Add extra fixes * Remove WriteOptions initialization Co-authored-by: Owl Bot --- .readme-partials.yaml | 3 ++ README.md | 3 ++ .../logging/logback/LoggingAppender.java | 28 +++++++++++++------ .../logging/logback/LoggingAppenderTest.java | 21 ++++++++++++++ .../logging/logback/dummy-credentials.json | 12 ++++++++ 5 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 src/test/java/com/google/cloud/logging/logback/dummy-credentials.json diff --git a/.readme-partials.yaml b/.readme-partials.yaml index 0f353fb59..8f99019a7 100644 --- a/.readme-partials.yaml +++ b/.readme-partials.yaml @@ -25,6 +25,9 @@ custom_content: | /path/to/credentials/file + + String + com.example.enhancers.TestLoggingEnhancer com.example.enhancers.AnotherEnhancer diff --git a/README.md b/README.md index 0efd2e138..019518b9b 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,9 @@ See [Logback filters](https://logback.qos.ch/manual/filters.html#thresholdFilter /path/to/credentials/file + + String + com.example.enhancers.TestLoggingEnhancer com.example.enhancers.AnotherEnhancer 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 e1fb253aa..e4d5128a6 100644 --- a/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java +++ b/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java @@ -75,6 +75,9 @@ * <!-- Optional: defaults to the default credentials of the environment --> * <credentialsFile>/path/to/credentials/file</credentialsFile> * + * <!-- Optional: defaults to the project id obtained during authentication process. Project id is also used to construct resource name of the log entries --> + * <logDestinationProjectId>String</logDestinationProjectId> + * * <!-- Optional: add custom labels to log entries using {@link LoggingEnhancer} classes --> * <enhancer>com.example.enhancers.TestLoggingEnhancer</enhancer> * <enhancer>com.example.enhancers.AnotherEnhancer</enhancer> @@ -101,6 +104,7 @@ public class LoggingAppender extends UnsynchronizedAppenderBase { private String log; private String resourceType; private String credentialsFile; + private String logDestinationProjectId; private Synchronicity writeSyncFlag = Synchronicity.ASYNC; private final Set enhancerClassNames = new HashSet<>(); private final Set loggingEventEnhancerClassNames = new HashSet<>(); @@ -151,6 +155,16 @@ public void setCredentialsFile(String credentialsFile) { this.credentialsFile = credentialsFile; } + /** + * Sets project ID to be used to customize log destination name for written log entries. + * + * @param projectId The project ID to be used to construct the resource destination name for log + * entries. + */ + public void setLogDestinationProjectId(String projectId) { + this.logDestinationProjectId = projectId; + } + /** * Define synchronization mode for writing log entries. * @@ -293,15 +307,12 @@ public void flush() { /** Gets the {@link LoggingOptions} to use for this {@link LoggingAppender}. */ protected LoggingOptions getLoggingOptions() { if (loggingOptions == null) { - if (Strings.isNullOrEmpty(credentialsFile)) { - loggingOptions = LoggingOptions.getDefaultInstance(); - } else { + LoggingOptions.Builder builder = LoggingOptions.newBuilder(); + builder.setProjectId(logDestinationProjectId); + if (!Strings.isNullOrEmpty(credentialsFile)) { try { - loggingOptions = - LoggingOptions.newBuilder() - .setCredentials( - GoogleCredentials.fromStream(new FileInputStream(credentialsFile))) - .build(); + builder.setCredentials( + GoogleCredentials.fromStream(new FileInputStream(credentialsFile))); } catch (IOException e) { throw new RuntimeException( String.format( @@ -310,6 +321,7 @@ protected LoggingOptions getLoggingOptions() { e); } } + loggingOptions = builder.build(); } return loggingOptions; } 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 ab6cd8346..2805abd35 100644 --- a/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java +++ b/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java @@ -50,6 +50,10 @@ @RunWith(EasyMockRunner.class) public class LoggingAppenderTest { private final String projectId = "test-project"; + private final String credentialFileProjectId = "project-12345"; + private final String overridenProjectId = "some-project-id"; + private final String dummyCredentialsFile = + "src/test/java/com/google/cloud/logging/logback/dummy-credentials.json"; private Logging logging; private LoggingAppender loggingAppender; @@ -273,6 +277,23 @@ public void testCreateLoggingOptions() { } } + @Test + public void testCreateLoggingOptionsWithCredentials() { + // Try to build LoggingOptions with file based credentials. + LoggingAppender appender = new LoggingAppender(); + appender.setCredentialsFile(dummyCredentialsFile); + assertThat(appender.getLoggingOptions().getProjectId()).isEqualTo(credentialFileProjectId); + } + + @Test + public void testCreateLoggingOptionsWithDestination() { + // Try to build LoggingOptions with file based credentials. + LoggingAppender appender = new LoggingAppender(); + appender.setCredentialsFile(dummyCredentialsFile); + appender.setLogDestinationProjectId(overridenProjectId); + assertThat(appender.getLoggingOptions().getProjectId()).isEqualTo(overridenProjectId); + } + private LoggingEvent createLoggingEvent(Level level, long timestamp) { LoggingEvent loggingEvent = new LoggingEvent(); loggingEvent.setMessage("this is a test"); diff --git a/src/test/java/com/google/cloud/logging/logback/dummy-credentials.json b/src/test/java/com/google/cloud/logging/logback/dummy-credentials.json new file mode 100644 index 000000000..c99e8764e --- /dev/null +++ b/src/test/java/com/google/cloud/logging/logback/dummy-credentials.json @@ -0,0 +1,12 @@ +{ + "type": "service_account", + "project_id": "project-12345", + "private_key_id": "12345", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKhPSTDs4cpKfnMc\np86fCkpnuER7bGc+mGkhkw6bE+BnROfrDCFBSjrENLS5JcsenANQ1kYGt9iVW2fd\nZAWUdDoj+t7g6+fDpzY1BzPSUls421Dmu7joDPY8jSdMzFCeg7Lyj0I36bJJ7ooD\nVPW6Q0XQcb8FfBiFPAKuY4elj/YDAgMBAAECgYBo2GMWmCmbM0aL/KjH/KiTawMN\nnfkMY6DbtK9/5LjADHSPKAt5V8ueygSvI7rYSiwToLKqEptJztiO3gnls/GmFzj1\nV/QEvFs6Ux3b0hD2SGpGy1m6NWWoAFlMISRkNiAxo+AMdCi4I1hpk4+bHr9VO2Bv\nV0zKFxmgn1R8qAR+4QJBANqKxJ/qJ5+lyPuDYf5s+gkZWjCLTC7hPxIJQByDLICw\niEnqcn0n9Gslk5ngJIGQcKBXIp5i0jWSdKN/hLxwgHECQQDFKGmo8niLzEJ5sa1r\nspww8Hc2aJM0pBwceshT8ZgVPnpgmITU1ENsKpJ+y1RTjZD6N0aj9gS9UB/UXdTr\nHBezAkEAqkDRTYOtusH9AXQpM3zSjaQijw72Gs9/wx1RxOSsFtVwV6U97CLkV1S+\n2HG1/vn3w/IeFiYGfZXLKFR/pA5BAQJAbFeu6IaGM9yFUzaOZDZ8mnAqMp349t6Q\nDB5045xJxLLWsSpfJE2Y12H1qvO1XUzYNIgXq5ZQOHBFbYA6txBy/QJBAKDRQN47\n6YClq9652X+1lYIY/h8MxKiXpVZVncXRgY6pbj4pmWEAM88jra9Wq6R77ocyECzi\nXCqi18A/sl6ymWc=\n-----END PRIVATE KEY-----\n", + "client_email": "project-12345@appspot.gserviceaccount.com", + "client_id": "123456789012345678901", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/project-12345%40appspot.gserviceaccount.com" + } From 37ca7179c455451fdd34baae0463223d67a36b5b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 15 Jan 2022 20:50:48 +0100 Subject: [PATCH 14/17] deps: update dependency org.slf4j:slf4j-api to v1.7.33 (#652) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f97305bfb..494f31122 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.3 1.1.3 3.6.0 - 1.7.32 + 1.7.33 1.10.1 From 8f99e757924b84f3d9c4987c4ee2c96bd4782de1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 17 Jan 2022 21:06:22 +0000 Subject: [PATCH 15/17] chore(java): update release_type choices to stable and preview (#1331) (#658) --- .github/.OwlBot.lock.yaml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index dddb13b84..dcdda8c6d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:7f737996c88586c499f7b0c25294c760f9f5eec092289a0e08d2d3f42a069ebb + digest: sha256:9669c169d0582f13d6b2d319a43a78fc49f296a883aa48519bd0e5c7d34087c4 diff --git a/README.md b/README.md index 019518b9b..27a2edb1c 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-logging-logback/java8-win.html [kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-logging-logback/java11.svg [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-logging-logback/java11.html -[stability-image]: https://img.shields.io/badge/stability-alpha-orange +[stability-image]: https://img.shields.io/badge/stability-preview-yellow [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-logging-logback.svg [maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-logging-logback&core=gav [authentication]: https://github.com/googleapis/google-cloud-java#authentication From 65307826f1f352e621eb1c24a867319e1bfe08ec Mon Sep 17 00:00:00 2001 From: minherz Date: Tue, 18 Jan 2022 20:59:28 +0200 Subject: [PATCH 16/17] feat: enable auto-population of missing metadata in logs and printing structured logs to stdout (#654) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add support for metadata auto-population and redirection to STDOUT (#649) Add configuration to opt-out metadata auto-population. Add configuration to redirect appender output to stdout. Add relevant unit tests. Refactor unit tests. Improve javadoc comments for methods. Remove warnings. Make methods with no modifier to be private. * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .readme-partials.yaml | 42 ++- README.md | 41 ++- .../logging/logback/LoggingAppender.java | 183 ++++++--- .../enhancers/AnotherTestLoggingEnhancer.java | 28 -- .../enhancers/TestLoggingEnhancer.java | 28 -- .../logging/logback/LoggingAppenderTest.java | 347 +++++++++++------- 6 files changed, 411 insertions(+), 258 deletions(-) delete mode 100644 src/test/java/com/example/enhancers/AnotherTestLoggingEnhancer.java delete mode 100644 src/test/java/com/example/enhancers/TestLoggingEnhancer.java diff --git a/.readme-partials.yaml b/.readme-partials.yaml index 8f99019a7..f25287604 100644 --- a/.readme-partials.yaml +++ b/.readme-partials.yaml @@ -19,7 +19,16 @@ custom_content: | WARNING - + + SYNC + + + false + + + true + + @@ -39,7 +48,7 @@ custom_content: | ``` - In your code : + In your code: ```java import org.slf4j.Logger; @@ -57,4 +66,31 @@ custom_content: | testLogger.log("test"); } } - ``` \ No newline at end of file + ``` + + ### Populate log entries with metadata + + The library provides multiple ways to enrich log entries with additional information. + You can select one or more ways to customize log entries that will be written into Cloud Logging. + + * Manually update a log entry using [`LoggingEnhancer`] + (https://github.com/googleapis/java-logging/blob/main/google-cloud-logging/src/main/java/com/google/cloud/logging/. + * Use [`ILoggingEvent`](https://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html) to update a log entry with [`LoggingEventEnhancer`] + (https://github.com/googleapis/java-logging-logback/blob/main/src/main/java/com/google/cloud/logging/logback/LoggingEventEnhancer.java). + * Enable [auto-population](https://github.com/googleapis/java-logging#auto-population-of-log-entrys-metadata) of the `LogEntry` metadata using the `autoPopulateMetadata` configuration flag. + + #### Optimize log ingestion + + By default, the appender will ingest log entries asynchronously by calling Logging API. + Multiple calls may be aggregated before being sent to improve use of API quota and bandwidth. + You can set the `writeSynchronicity` configuration flag to `SYNC` if they want to ingest log entries synchronously. + Note that configuring synchronous ingestion will probably result in performance penalties to your applications. + If you plan to deploy your application in one of Google Cloud managed environments (e.g. Cloud Run, Cloud Function or App Engine), + you can leverage the support provided by the implicit logging agent and the [structured logging](https://cloud.google.com/logging/docs/structured-logging) feature. + To use it, set the `redirectToStdout` configuration flag to `true`. + This flag instructs the appender to print the log entries to `stdout` instead of ingesting them using Logging API. + The log entries are printed using the [structured logging Json format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields). + In result, the logging agent will be responsible for ingesting the logs to Logging API. + Note that using the structured logging Json format you cannot control the log name where the logs will be ingested. + The logs will be ingested into the project that hosts the environment where your application is running. + The configuration `logDestinationProjectId` will be ignored. diff --git a/README.md b/README.md index 27a2edb1c..893510da7 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,16 @@ See [Logback filters](https://logback.qos.ch/manual/filters.html#thresholdFilter WARNING - + + SYNC + + + false + + + true + + @@ -110,7 +119,7 @@ See [Logback filters](https://logback.qos.ch/manual/filters.html#thresholdFilter ``` -In your code : +In your code: ```java import org.slf4j.Logger; @@ -130,6 +139,34 @@ public class TestLogger { } ``` +### Populate log entries with metadata + +The library provides multiple ways to enrich log entries with additional information. +You can select one or more ways to customize log entries that will be written into Cloud Logging. + +* Manually update a log entry using [`LoggingEnhancer`] +(https://github.com/googleapis/java-logging/blob/main/google-cloud-logging/src/main/java/com/google/cloud/logging/. +* Use [`ILoggingEvent`](https://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html) to update a log entry with [`LoggingEventEnhancer`] +(https://github.com/googleapis/java-logging-logback/blob/main/src/main/java/com/google/cloud/logging/logback/LoggingEventEnhancer.java). +* Enable [auto-population](https://github.com/googleapis/java-logging#auto-population-of-log-entrys-metadata) of the `LogEntry` metadata using the `autoPopulateMetadata` configuration flag. + +#### Optimize log ingestion + +By default, the appender will ingest log entries asynchronously by calling Logging API. +Multiple calls may be aggregated before being sent to improve use of API quota and bandwidth. +You can set the `writeSynchronicity` configuration flag to `SYNC` if they want to ingest log entries synchronously. +Note that configuring synchronous ingestion will probably result in performance penalties to your applications. +If you plan to deploy your application in one of Google Cloud managed environments (e.g. Cloud Run, Cloud Function or App Engine), +you can leverage the support provided by the implicit logging agent and the [structured logging](https://cloud.google.com/logging/docs/structured-logging) feature. +To use it, set the `redirectToStdout` configuration flag to `true`. +This flag instructs the appender to print the log entries to `stdout` instead of ingesting them using Logging API. +The log entries are printed using the [structured logging Json format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields). +In result, the logging agent will be responsible for ingesting the logs to Logging API. +Note that using the structured logging Json format you cannot control the log name where the logs will be ingested. +The logs will be ingested into the project that hosts the environment where your application is running. +The configuration `logDestinationProjectId` will be ignored. + + ## Samples 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 e4d5128a6..a8b751077 100644 --- a/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java +++ b/src/main/java/com/google/cloud/logging/logback/LoggingAppender.java @@ -38,6 +38,7 @@ import com.google.common.collect.ImmutableList; import java.io.FileInputStream; import java.io.IOException; +import java.time.Instant; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -58,15 +59,21 @@ * <level>INFO</level> * </filter> * - * <!-- Optional: defaults to "java.log" --> + * <!-- Optional: defaults to {@code "java.log"} --> * <log>application.log</log> * - * <!-- Optional: defaults to "ERROR" --> + * <!-- Optional: defaults to {@code "ERROR"} --> * <flushLevel>WARNING</flushLevel> * - * <!-- Optional: defaults to ASYNC --> + * <!-- Optional: defaults to {@code ASYNC} --> * <writeSynchronicity>SYNC</writeSynchronicity> * + * <!-- Optional: defaults to {@code true} --> + * <autoPopulateMetadata>false</autoPopulateMetadata> + * + * <!-- Optional: defaults to {@code false} --> + * <redirectToStdout>true</redirectToStdout> + * * <!-- Optional: auto detects on App Engine Flex, Standard, GCE and GKE, defaults to "global". See supported resource types --> @@ -96,6 +103,7 @@ public class LoggingAppender extends UnsynchronizedAppenderBase { private volatile Logging logging; private LoggingOptions loggingOptions; + private MonitoredResource monitoredResource; private List loggingEnhancers; private List loggingEventEnhancers; private WriteOption[] defaultWriteOptions; @@ -105,14 +113,16 @@ public class LoggingAppender extends UnsynchronizedAppenderBase { private String resourceType; private String credentialsFile; private String logDestinationProjectId; + private boolean autoPopulateMetadata = true; + private boolean redirectToStdout = false; private Synchronicity writeSyncFlag = Synchronicity.ASYNC; private final Set enhancerClassNames = new HashSet<>(); private final Set loggingEventEnhancerClassNames = new HashSet<>(); /** - * Batched logging requests get immediately flushed for logs at or above this level. + * Sets a threshold for log severity level to flush all log entries that were batched so far. * - *

Defaults to Error if not set. + *

Defaults to Error. * * @param flushLevel Logback log level */ @@ -121,35 +131,37 @@ public void setFlushLevel(Level flushLevel) { } /** - * Sets the log filename. + * Sets the LOG_ID part of the https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.log_name + * for which the logs are ingested. * - * @param log filename + * @param log LOG_ID part of the name */ public void setLog(String log) { this.log = log; } /** - * Sets the name of the monitored resource (Optional). - * - *

Must be a supported resource type. - * gae_app, gce_instance and container are auto-detected. + * Sets the name of the monitored resource (Optional). If not define the appender will try to + * identify the resource type automatically. Currently support resource types include "gae_app", + * "gce_instance", "k8s_container", "cloud_run_revision" and "cloud_function". If the appender + * fails to identify the resource type it will be set to "global". * - *

Defaults to "global" + *

Must be a one of the supported resource types. * - * @param resourceType name of the monitored resource + * @param resourceType the name of the monitored resource. */ public void setResourceType(String resourceType) { this.resourceType = resourceType; } /** - * Sets the credentials file to use to create the {@link LoggingOptions}. The credentials returned - * by {@link GoogleCredentials#getApplicationDefault()} will be used if no custom credentials file - * has been set. + * Sets the path to the https://cloud.google.com/iam/docs/creating-managing-service-account-keys. If not set + * the appender will use {@link GoogleCredentials#getApplicationDefault()} to authenticate. * - * @param credentialsFile The credentials file to use. + * @param credentialsFile the path to the credentials file. */ public void setCredentialsFile(String credentialsFile) { this.credentialsFile = credentialsFile; @@ -166,14 +178,39 @@ public void setLogDestinationProjectId(String projectId) { } /** - * Define synchronization mode for writing log entries. + * Sets the log ingestion mode. It can be one of the {@link Synchronicity} values. * - * @param flag to set {@code Synchronicity} value. + *

Default to {@code Synchronicity.ASYNC} + * + * @param flag the new ingestion mode. */ public void setWriteSynchronicity(Synchronicity flag) { this.writeSyncFlag = flag; } + /** + * Sets the automatic population of metadata fields for ingested logs. + * + *

Default to {@code true}. + * + * @param flag the metadata auto-population flag. + */ + public void setAutoPopulateMetadata(boolean flag) { + autoPopulateMetadata = flag; + } + + /** + * Sets the redirect of the appender's output to STDOUT instead of ingesting logs to Cloud Logging + * using Logging API. + * + *

Default to {@code false}. + * + * @param flag the redirect flag. + */ + public void setRedirectToStdout(boolean flag) { + redirectToStdout = flag; + } + /** Add extra labels using classes that implement {@link LoggingEnhancer}. */ public void addEnhancer(String enhancerClassName) { this.enhancerClassNames.add(enhancerClassName); @@ -183,57 +220,68 @@ public void addLoggingEventEnhancer(String enhancerClassName) { this.loggingEventEnhancerClassNames.add(enhancerClassName); } - Level getFlushLevel() { - return (flushLevel != null) ? flushLevel : Level.ERROR; + /** + * Returns the current value of the ingestion mode. + * + *

The method is deprecated. Use appender configuration to setup the ingestion + * + * @return a {@link Synchronicity} value of the ingestion module. + */ + @Deprecated + public Synchronicity getWriteSynchronicity() { + return (this.writeSyncFlag != null) ? this.writeSyncFlag : Synchronicity.ASYNC; } - String getLogName() { - return (log != null) ? log : "java.log"; + private void setupMonitoredResource() { + if (monitoredResource == null && autoPopulateMetadata) { + monitoredResource = MonitoredResourceUtil.getResource(getProjectId(), resourceType); + } } - public Synchronicity getWriteSynchronicity() { - return (this.writeSyncFlag != null) ? this.writeSyncFlag : Synchronicity.ASYNC; + @InternalApi("Visible for testing") + void setupMonitoredResource(MonitoredResource monitoredResource) { + this.monitoredResource = monitoredResource; + } + + private Level getFlushLevel() { + return (flushLevel != null) ? flushLevel : Level.ERROR; } - MonitoredResource getMonitoredResource(String projectId) { - return MonitoredResourceUtil.getResource(projectId, resourceType); + private String getLogName() { + return (log != null) ? log : "java.log"; } - List getLoggingEnhancers() { - return getEnhancers(enhancerClassNames); + private List getLoggingEnhancers() { + return getEnhancers(enhancerClassNames, LoggingEnhancer.class); } - List getLoggingEventEnhancers() { + private List getLoggingEventEnhancers() { if (loggingEventEnhancerClassNames.isEmpty()) { return DEFAULT_LOGGING_EVENT_ENHANCERS; } else { - return getEnhancers(loggingEventEnhancerClassNames); + return getEnhancers(loggingEventEnhancerClassNames, LoggingEventEnhancer.class); } } - List getEnhancers(Set classNames) { - List loggingEnhancers = new ArrayList<>(); + private List getEnhancers(Set classNames, Class classOfT) { + List enhancers = new ArrayList<>(); if (classNames != null) { - for (String enhancerClassName : classNames) { - if (enhancerClassName != null) { - T enhancer = getEnhancer(enhancerClassName); - if (enhancer != null) { - loggingEnhancers.add(enhancer); + for (String className : classNames) { + if (className != null) { + try { + T enhancer = + Loader.loadClass(className.trim()) + .asSubclass(classOfT) + .getDeclaredConstructor() + .newInstance(); + enhancers.add(enhancer); + } catch (Exception ex) { + // invalid className: ignore } } } } - return loggingEnhancers; - } - - private T getEnhancer(String enhancerClassName) { - try { - Class clz = (Class) Loader.loadClass(enhancerClassName.trim()); - return clz.getDeclaredConstructor().newInstance(); - } catch (Exception ex) { - // If we cannot create the enhancer we fallback to null - } - return null; + return enhancers; } /** Initialize and configure the cloud logging service. */ @@ -242,9 +290,13 @@ public synchronized void start() { if (isStarted()) { return; } - MonitoredResource resource = getMonitoredResource(getProjectId()); + + setupMonitoredResource(); + defaultWriteOptions = - new WriteOption[] {WriteOption.logName(getLogName()), WriteOption.resource(resource)}; + new WriteOption[] { + WriteOption.logName(getLogName()), WriteOption.resource(monitoredResource) + }; Level flushLevel = getFlushLevel(); if (flushLevel != Level.OFF) { getLogging().setFlushSeverity(severityFor(flushLevel)); @@ -265,8 +317,26 @@ String getProjectId() { @Override protected void append(ILoggingEvent e) { - LogEntry logEntry = logEntryFor(e); - getLogging().write(Collections.singleton(logEntry), defaultWriteOptions); + Iterable entries = Collections.singleton(logEntryFor(e)); + if (autoPopulateMetadata) { + entries = + getLogging() + .populateMetadata( + entries, + monitoredResource, + "com.google.cloud.logging", + "jdk", + "sun", + "java", + "ch.qos.logback"); + } + if (redirectToStdout) { + for (LogEntry entry : entries) { + System.out.println(entry.toStructuredJsonString()); + } + } else { + getLogging().write(entries, defaultWriteOptions); + } } @Override @@ -295,6 +365,7 @@ Logging getLogging() { } /** Flushes any pending asynchronous logging writes. */ + @Deprecated public void flush() { if (!isStarted()) { return; @@ -321,6 +392,8 @@ protected LoggingOptions getLoggingOptions() { e); } } + // opt-out metadata auto-population to control it in the appender code + builder.setAutoPopulateMetadata(false); loggingOptions = builder.build(); } return loggingOptions; @@ -340,7 +413,7 @@ private LogEntry logEntryFor(ILoggingEvent e) { } LogEntry.Builder builder = LogEntry.newBuilder(Payload.JsonPayload.of(jsonContent)) - .setTimestamp(e.getTimeStamp()) + .setTimestamp(Instant.ofEpochMilli(e.getTimeStamp())) .setSeverity(severity); builder .addLabel(LEVEL_NAME_KEY, level.toString()) diff --git a/src/test/java/com/example/enhancers/AnotherTestLoggingEnhancer.java b/src/test/java/com/example/enhancers/AnotherTestLoggingEnhancer.java deleted file mode 100644 index d9da84471..000000000 --- a/src/test/java/com/example/enhancers/AnotherTestLoggingEnhancer.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.enhancers; - -import com.google.cloud.logging.LogEntry; -import com.google.cloud.logging.LoggingEnhancer; - -public class AnotherTestLoggingEnhancer implements LoggingEnhancer { - - @Override - public void enhanceLogEntry(LogEntry.Builder logEntry) { - logEntry.addLabel("test-label-2", "test-value-2"); - } -} diff --git a/src/test/java/com/example/enhancers/TestLoggingEnhancer.java b/src/test/java/com/example/enhancers/TestLoggingEnhancer.java deleted file mode 100644 index f982b3f06..000000000 --- a/src/test/java/com/example/enhancers/TestLoggingEnhancer.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.enhancers; - -import com.google.cloud.logging.LogEntry; -import com.google.cloud.logging.LoggingEnhancer; - -public class TestLoggingEnhancer implements LoggingEnhancer { - - @Override - public void enhanceLogEntry(LogEntry.Builder logEntry) { - logEntry.addLabel("test-label-1", "test-value-1"); - } -} 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 2805abd35..b71747af3 100644 --- a/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java +++ b/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java @@ -22,7 +22,6 @@ import static org.easymock.EasyMock.expectLastCall; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; -import static org.junit.Assert.fail; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.filter.ThresholdFilter; @@ -33,11 +32,15 @@ import com.google.cloud.logging.LogEntry; import com.google.cloud.logging.Logging; import com.google.cloud.logging.Logging.WriteOption; -import com.google.cloud.logging.LoggingOptions; -import com.google.cloud.logging.Payload.JsonPayload; +import com.google.cloud.logging.LoggingEnhancer; +import com.google.cloud.logging.Payload; import com.google.cloud.logging.Severity; +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.util.HashMap; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.time.Instant; import java.util.Map; import org.easymock.Capture; import org.easymock.EasyMock; @@ -49,18 +52,83 @@ @RunWith(EasyMockRunner.class) public class LoggingAppenderTest { - private final String projectId = "test-project"; - private final String credentialFileProjectId = "project-12345"; - private final String overridenProjectId = "some-project-id"; - private final String dummyCredentialsFile = + private static final String PROJECT_ID = "test-project"; + private static final String CRED_FILE_PROJECT_ID = "project-12345"; + private static final String OVERRIDED_PROJECT_ID = "some-project-id"; + private static final String DUMMY_CRED_FILE_PATH = "src/test/java/com/google/cloud/logging/logback/dummy-credentials.json"; + private static Payload.JsonPayload JSON_PAYLOAD = + Payload.JsonPayload.of(ImmutableMap.of("message", "this is a test")); + private static Payload.JsonPayload JSON_ERROR_PAYLOAD = + Payload.JsonPayload.of( + ImmutableMap.of( + "message", + "this is a test", + "@type", + "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent")); + private static final MonitoredResource DEFAULT_RESOURCE = + MonitoredResource.of("global", ImmutableMap.of("project_id", PROJECT_ID)); + private static final LogEntry WARN_ENTRY = + LogEntry.newBuilder(JSON_PAYLOAD) + .setTimestamp(Instant.ofEpochMilli(100000L)) + .setSeverity(Severity.WARNING) + .setLabels( + new ImmutableMap.Builder() + .put("levelName", "WARN") + .put("levelValue", String.valueOf(30000L)) + .put("loggerName", LoggingAppenderTest.class.getName()) + // .put("test-label-1", "test-value-1") + // .put("test-label-2", "test-value-2") + .build()) + .build(); + private static final LogEntry ERROR_ENTRY = + LogEntry.newBuilder(JSON_ERROR_PAYLOAD) + .setTimestamp(Instant.ofEpochMilli(100000L)) + .setSeverity(Severity.ERROR) + .setLabels( + new ImmutableMap.Builder() + .put("levelName", "ERROR") + .put("levelValue", String.valueOf(40000L)) + .put("loggerName", LoggingAppenderTest.class.getName()) + .build()) + .build(); + private static final LogEntry INFO_ENTRY = + LogEntry.newBuilder(JSON_PAYLOAD) + .setTimestamp(Instant.ofEpochMilli(100000L)) + .setSeverity(Severity.INFO) + .setLabels( + new ImmutableMap.Builder() + .put("levelName", "INFO") + .put("levelValue", String.valueOf(20000L)) + .put("loggerName", LoggingAppenderTest.class.getName()) + .put("mdc1", "value1") + .put("mdc2", "value2") + .build()) + .build(); + private Logging logging; private LoggingAppender loggingAppender; + static class CustomLoggingEventEnhancer implements LoggingEventEnhancer { + + @Override + public void enhanceLogEntry(LogEntry.Builder builder, ILoggingEvent e) { + builder.addLabel("foo", "bar"); + } + } + + static class CustomLoggingEnhancer implements LoggingEnhancer { + + @Override + public void enhanceLogEntry(LogEntry.Builder builder) { + builder.addLabel("foo", "bar"); + } + } + class TestLoggingAppender extends LoggingAppender { @Override String getProjectId() { - return projectId; + return PROJECT_ID; } @Override @@ -73,6 +141,7 @@ Logging getLogging() { public void setUp() { logging = EasyMock.createStrictMock(Logging.class); loggingAppender = new TestLoggingAppender(); + loggingAppender.setAutoPopulateMetadata(false); } private final WriteOption[] defaultWriteOptions = @@ -81,29 +150,18 @@ public void setUp() { WriteOption.resource( MonitoredResource.newBuilder("global") .setLabels( - new ImmutableMap.Builder().put("project_id", projectId).build()) + new ImmutableMap.Builder() + .put("project_id", PROJECT_ID) + .build()) .build()) }; @Test public void testFlushLevelConfigUpdatesLoggingFlushSeverity() { - Map jsonContent = new HashMap<>(); - jsonContent.put("message", "this is a test"); - JsonPayload payload = JsonPayload.of(jsonContent); - LogEntry logEntry = - LogEntry.newBuilder(payload) - .setTimestamp(100000L) - .setSeverity(Severity.WARNING) - .setLabels( - new ImmutableMap.Builder() - .put("levelName", "WARN") - .put("levelValue", String.valueOf(30000L)) - .put("loggerName", this.getClass().getName()) - .build()) - .build(); logging.setFlushSeverity(Severity.WARNING); Capture> capturedArgument = Capture.newInstance(); - logging.write(capture(capturedArgument), (WriteOption) anyObject(), (WriteOption) anyObject()); + logging.write( + capture(capturedArgument), anyObject(WriteOption.class), anyObject(WriteOption.class)); replay(logging); Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); LoggingEvent loggingEvent = createLoggingEvent(Level.WARN, timestamp.getSeconds()); @@ -113,7 +171,7 @@ public void testFlushLevelConfigUpdatesLoggingFlushSeverity() { loggingAppender.doAppend(loggingEvent); verify(logging); assertThat(capturedArgument.getValue().iterator().hasNext()).isTrue(); - assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(logEntry); + assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(WARN_ENTRY); } @Test @@ -126,26 +184,10 @@ public void testFlushLevelConfigSupportsFlushLevelOff() { @Test public void testFilterLogsOnlyLogsAtOrAboveLogLevel() { - Map jsonContent = new HashMap<>(); - jsonContent.put("message", "this is a test"); - jsonContent.put( - "@type", - "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent"); - JsonPayload payload = JsonPayload.of(jsonContent); - LogEntry logEntry = - LogEntry.newBuilder(payload) - .setTimestamp(100000L) - .setSeverity(Severity.ERROR) - .setLabels( - new ImmutableMap.Builder() - .put("levelName", "ERROR") - .put("levelValue", String.valueOf(40000L)) - .put("loggerName", this.getClass().getName()) - .build()) - .build(); logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); - logging.write(capture(capturedArgument), (WriteOption) anyObject(), (WriteOption) anyObject()); + logging.write( + capture(capturedArgument), anyObject(WriteOption.class), anyObject(WriteOption.class)); expectLastCall().once(); replay(logging); Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); @@ -162,41 +204,7 @@ public void testFilterLogsOnlyLogsAtOrAboveLogLevel() { loggingAppender.doAppend(loggingEvent2); verify(logging); assertThat(capturedArgument.getValue().iterator().hasNext()).isTrue(); - assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(logEntry); - } - - @Test - public void testEnhancersAddCorrectLabelsToLogEntries() { - Map jsonContent = new HashMap<>(); - jsonContent.put("message", "this is a test"); - JsonPayload payload = JsonPayload.of(jsonContent); - LogEntry logEntry = - LogEntry.newBuilder(payload) - .setTimestamp(100000L) - .setSeverity(Severity.WARNING) - .setLabels( - new ImmutableMap.Builder() - .put("levelName", "WARN") - .put("levelValue", String.valueOf(30000L)) - .put("loggerName", this.getClass().getName()) - .put("test-label-1", "test-value-1") - .put("test-label-2", "test-value-2") - .build()) - .build(); - logging.setFlushSeverity(Severity.ERROR); - Capture> capturedArgument = Capture.newInstance(); - logging.write(capture(capturedArgument), (WriteOption) anyObject(), (WriteOption) anyObject()); - expectLastCall().once(); - replay(logging); - loggingAppender.addEnhancer("com.example.enhancers.TestLoggingEnhancer"); - loggingAppender.addEnhancer("com.example.enhancers.AnotherTestLoggingEnhancer"); - loggingAppender.start(); - Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); - LoggingEvent loggingEvent = createLoggingEvent(Level.WARN, timestamp.getSeconds()); - loggingAppender.doAppend(loggingEvent); - verify(logging); - assertThat(capturedArgument.getValue().iterator().hasNext()).isTrue(); - assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(logEntry); + assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(ERROR_ENTRY); } @Test @@ -204,7 +212,8 @@ public void testDefaultWriteOptionsHasExpectedDefaults() { logging.setFlushSeverity(Severity.ERROR); Capture logNameArg = Capture.newInstance(); Capture resourceArg = Capture.newInstance(); - logging.write((Iterable) anyObject(), capture(logNameArg), capture(resourceArg)); + logging.write( + EasyMock.>anyObject(), capture(logNameArg), capture(resourceArg)); expectLastCall().once(); replay(logging); loggingAppender.start(); @@ -219,25 +228,10 @@ public void testDefaultWriteOptionsHasExpectedDefaults() { @Test public void testMdcValuesAreConvertedToLabels() { - Map jsonContent = new HashMap<>(); - jsonContent.put("message", "this is a test"); - JsonPayload payload = JsonPayload.of(jsonContent); - LogEntry logEntry = - LogEntry.newBuilder(payload) - .setTimestamp(100000L) - .setSeverity(Severity.INFO) - .setLabels( - new ImmutableMap.Builder() - .put("levelName", "INFO") - .put("levelValue", String.valueOf(20000L)) - .put("loggerName", this.getClass().getName()) - .put("mdc1", "value1") - .put("mdc2", "value2") - .build()) - .build(); logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); - logging.write(capture(capturedArgument), (WriteOption) anyObject(), (WriteOption) anyObject()); + logging.write( + capture(capturedArgument), anyObject(WriteOption.class), anyObject(WriteOption.class)); expectLastCall().once(); replay(logging); Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); @@ -248,50 +242,32 @@ public void testMdcValuesAreConvertedToLabels() { loggingAppender.doAppend(loggingEvent); verify(logging); assertThat(capturedArgument.getValue().iterator().hasNext()).isTrue(); - assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(logEntry); + assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(INFO_ENTRY); } - @Test - public void testCreateLoggingOptions() { - // Try to build LoggingOptions with custom credentials. + @Test(expected = RuntimeException.class) + public void testCreateLoggingOptionsWithInvalidCredentials() { final String nonExistentFile = "/path/to/non/existent/file"; LoggingAppender appender = new LoggingAppender(); appender.setCredentialsFile(nonExistentFile); - try { - appender.getLoggingOptions(); - fail("Expected exception"); - } catch (Exception e) { - assertThat(e.getMessage().contains(nonExistentFile)); - } - // Try to build LoggingOptions with default credentials. - LoggingOptions defaultOptions = null; - try { - defaultOptions = LoggingOptions.getDefaultInstance(); - } catch (Exception e) { - // Could not build a default LoggingOptions instance. - } - if (defaultOptions != null) { - appender = new LoggingAppender(); - LoggingOptions options = appender.getLoggingOptions(); - assertThat(options).isEqualTo(defaultOptions); - } + appender.getLoggingOptions(); } @Test public void testCreateLoggingOptionsWithCredentials() { // Try to build LoggingOptions with file based credentials. LoggingAppender appender = new LoggingAppender(); - appender.setCredentialsFile(dummyCredentialsFile); - assertThat(appender.getLoggingOptions().getProjectId()).isEqualTo(credentialFileProjectId); + appender.setCredentialsFile(DUMMY_CRED_FILE_PATH); + assertThat(appender.getLoggingOptions().getProjectId()).isEqualTo(CRED_FILE_PROJECT_ID); } @Test public void testCreateLoggingOptionsWithDestination() { // Try to build LoggingOptions with file based credentials. LoggingAppender appender = new LoggingAppender(); - appender.setCredentialsFile(dummyCredentialsFile); - appender.setLogDestinationProjectId(overridenProjectId); - assertThat(appender.getLoggingOptions().getProjectId()).isEqualTo(overridenProjectId); + appender.setCredentialsFile(DUMMY_CRED_FILE_PATH); + appender.setLogDestinationProjectId(OVERRIDED_PROJECT_ID); + assertThat(appender.getLoggingOptions().getProjectId()).isEqualTo(OVERRIDED_PROJECT_ID); } private LoggingEvent createLoggingEvent(Level level, long timestamp) { @@ -310,7 +286,8 @@ public void testMdcValuesAreConvertedToLabelsWithPassingNullValues() { MDC.put("mdc3", "value3"); logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); - logging.write(capture(capturedArgument), (WriteOption) anyObject(), (WriteOption) anyObject()); + logging.write( + capture(capturedArgument), anyObject(WriteOption.class), anyObject(WriteOption.class)); expectLastCall().once(); replay(logging); Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); @@ -332,13 +309,13 @@ public void testAddCustomLoggingEventEnhancers() { MDC.put("mdc1", "value1"); logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); - logging.write(capture(capturedArgument), (WriteOption) anyObject(), (WriteOption) anyObject()); + logging.write( + capture(capturedArgument), anyObject(WriteOption.class), anyObject(WriteOption.class)); expectLastCall().once(); replay(logging); Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); LoggingEvent loggingEvent = createLoggingEvent(Level.INFO, timestamp.getSeconds()); - loggingAppender.addLoggingEventEnhancer(CustomLoggingEventEnhancer1.class.getName()); - loggingAppender.addLoggingEventEnhancer(CustomLoggingEventEnhancer2.class.getName()); + loggingAppender.addLoggingEventEnhancer(CustomLoggingEventEnhancer.class.getName()); loggingAppender.start(); loggingAppender.doAppend(loggingEvent); verify(logging); @@ -346,15 +323,36 @@ public void testAddCustomLoggingEventEnhancers() { Map capturedArgumentMap = capturedArgument.getValue().iterator().next().getLabels(); assertThat(capturedArgumentMap.get("mdc1")).isNull(); - assertThat(capturedArgumentMap.get("foo")).isEqualTo("foo"); - assertThat(capturedArgumentMap.get("bar")).isEqualTo("bar"); + assertThat(capturedArgumentMap.get("foo")).isEqualTo("bar"); } @Test - public void testFlush() { + public void testAddCustomLoggingEnhancer() { logging.setFlushSeverity(Severity.ERROR); Capture> capturedArgument = Capture.newInstance(); - logging.write(capture(capturedArgument), (WriteOption) anyObject(), (WriteOption) anyObject()); + logging.write( + capture(capturedArgument), anyObject(WriteOption.class), anyObject(WriteOption.class)); + expectLastCall().once(); + replay(logging); + loggingAppender.addEnhancer(CustomLoggingEnhancer.class.getName()); + loggingAppender.start(); + Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); + LoggingEvent loggingEvent = createLoggingEvent(Level.WARN, timestamp.getSeconds()); + loggingAppender.doAppend(loggingEvent); + verify(logging); + Map capturedArgumentMap = + capturedArgument.getValue().iterator().next().getLabels(); + assertThat(capturedArgumentMap.get("foo")).isEqualTo("bar"); + } + + @Test + @SuppressWarnings("deprecation") + public void testFlush() { + logging.setFlushSeverity(Severity.ERROR); + logging.write( + EasyMock.>anyObject(), + anyObject(WriteOption.class), + anyObject(WriteOption.class)); expectLastCall().times(2); logging.flush(); replay(logging); @@ -368,19 +366,84 @@ public void testFlush() { verify(logging); } - static class CustomLoggingEventEnhancer1 implements LoggingEventEnhancer { + @Test + public void testAutoPopulationEnabled() { + logging.setFlushSeverity(Severity.ERROR); + Capture> capturedLogEntries = Capture.newInstance(); + EasyMock.expect( + logging.populateMetadata( + capture(capturedLogEntries), + EasyMock.eq(DEFAULT_RESOURCE), + EasyMock.eq("com.google.cloud.logging"), + EasyMock.eq("jdk"), + EasyMock.eq("sun"), + EasyMock.eq("java"), + EasyMock.eq("ch.qos.logback"))) + .andReturn(ImmutableList.of(INFO_ENTRY)) + .once(); + // it is impossible to define expectation for varargs using a single anyObject() matcher + // see the EasyMock bug https://github.com/easymock/easymock/issues/130. + // the following mock uses the known fact that the method pass two WriteOption arguments + // the arguments should be replaced with a single anyObject() matchers when the bug is fixed + logging.write( + EasyMock.>anyObject(), + anyObject(WriteOption.class), + anyObject(WriteOption.class)); + expectLastCall().once(); + replay(logging); - @Override - public void enhanceLogEntry(LogEntry.Builder builder, ILoggingEvent e) { - builder.addLabel("foo", "foo"); - } + loggingAppender.setupMonitoredResource(DEFAULT_RESOURCE); + loggingAppender.setAutoPopulateMetadata(true); + loggingAppender.start(); + Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); + LoggingEvent loggingEvent = createLoggingEvent(Level.INFO, timestamp.getSeconds()); + loggingEvent.setMDCPropertyMap(ImmutableMap.of("mdc1", "value1", "mdc2", "value2")); + loggingAppender.doAppend(loggingEvent); + verify(logging); + LogEntry testLogEntry = capturedLogEntries.getValue().iterator().next(); + assertThat(testLogEntry).isEqualTo(INFO_ENTRY); } - static class CustomLoggingEventEnhancer2 implements LoggingEventEnhancer { + @Test + public void testRedirectToStdoutEnabled() { + logging.setFlushSeverity(Severity.ERROR); + EasyMock.expect( + logging.populateMetadata( + EasyMock.>anyObject(), + EasyMock.anyObject(MonitoredResource.class), + EasyMock.anyString(), + EasyMock.anyString(), + EasyMock.anyString(), + EasyMock.anyString(), + EasyMock.anyString())) + .andReturn(ImmutableList.of(INFO_ENTRY)) + .once(); + replay(logging); - @Override - public void enhanceLogEntry(LogEntry.Builder builder, ILoggingEvent e) { - builder.addLabel("bar", "bar"); - } + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + PrintStream out = new PrintStream(bout); + System.setOut(out); + loggingAppender.setupMonitoredResource(DEFAULT_RESOURCE); + loggingAppender.setAutoPopulateMetadata(true); + loggingAppender.setRedirectToStdout(true); + loggingAppender.start(); + Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(100000, 0); + LoggingEvent loggingEvent = createLoggingEvent(Level.INFO, timestamp.getSeconds()); + loggingAppender.doAppend(loggingEvent); + verify(logging); + assertThat(Strings.isNullOrEmpty(bout.toString())).isFalse(); + System.setOut(null); + } + + @Test + public void testRedirectToStdoutDisabled() { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + PrintStream out = new PrintStream(bout); + System.setOut(out); + + testAutoPopulationEnabled(); + + assertThat(Strings.isNullOrEmpty(bout.toString())).isTrue(); + System.setOut(null); } } From 2345b6d2d866aec78e10e62b01fab736caddda93 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 18 Jan 2022 21:26:32 +0200 Subject: [PATCH 17/17] chore(main): release 0.123.0 (#645) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 20 ++++++++++++++++++++ pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa5751eab..310220ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [0.123.0](https://github.com/googleapis/java-logging-logback/compare/v0.122.9...v0.123.0) (2022-01-18) + + +### Features + +* Allow customizing written log entries by exposing parameters via appender configuration ([#625](https://github.com/googleapis/java-logging-logback/issues/625)) ([87d259f](https://github.com/googleapis/java-logging-logback/commit/87d259fe6453107a71560acb85b62ea30ccdd8ed)) +* enable auto-population of missing metadata in logs and printing structured logs to stdout ([#654](https://github.com/googleapis/java-logging-logback/issues/654)) ([6530782](https://github.com/googleapis/java-logging-logback/commit/65307826f1f352e621eb1c24a867319e1bfe08ec)) + + +### Bug Fixes + +* **java:** run Maven in plain console-friendly mode ([#1301](https://github.com/googleapis/java-logging-logback/issues/1301)) ([#621](https://github.com/googleapis/java-logging-logback/issues/621)) ([e5de531](https://github.com/googleapis/java-logging-logback/commit/e5de531465015ae735e45ee5b6dc52bdd281ee6e)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-logging to v3.6.0 ([#643](https://github.com/googleapis/java-logging-logback/issues/643)) ([21fdd35](https://github.com/googleapis/java-logging-logback/commit/21fdd3554ed2778075fec62a87176ad5e8a6f391)) +* update dependency org.easymock:easymock to v4 ([#640](https://github.com/googleapis/java-logging-logback/issues/640)) ([c1c5afc](https://github.com/googleapis/java-logging-logback/commit/c1c5afcf7a4501295e253c663fd4ac05c2fcd339)) +* update dependency org.slf4j:slf4j-api to v1.7.33 ([#652](https://github.com/googleapis/java-logging-logback/issues/652)) ([37ca717](https://github.com/googleapis/java-logging-logback/commit/37ca7179c455451fdd34baae0463223d67a36b5b)) + ### [0.122.9](https://www.github.com/googleapis/java-logging-logback/compare/v0.122.8...v0.122.9) (2022-01-10) diff --git a/pom.xml b/pom.xml index 494f31122..f8b4685cf 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 google-cloud-logging-logback - 0.122.10-alpha-SNAPSHOT + 0.123.0-alpha jar Google Cloud Logging Logback Appender https://github.com/googleapis/java-logging-logback diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index a335da085..97a219196 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-logging-logback - 0.122.10-alpha-SNAPSHOT + 0.123.0-alpha diff --git a/versions.txt b/versions.txt index 510b70127..2f47cd598 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-logging-logback:0.122.9-alpha:0.122.10-alpha-SNAPSHOT +google-cloud-logging-logback:0.123.0-alpha:0.123.0-alpha