Skip to content

Commit

Permalink
chore(logging): Improved logging dependencies for GCP and added Appli…
Browse files Browse the repository at this point in the history
…cation Context startup test
  • Loading branch information
berndruecker authored Dec 15, 2022
2 parents 2ac3c8c + a0a6f25 commit 70b9049
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 17 deletions.
25 changes: 17 additions & 8 deletions bundle/mvn/camunda-saas-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
</properties>

<dependencies>
<dependency>
<!-- Workaround for https://github.com/camunda/team-connectors/issues/251 to enforce proper version
Can be removed as soon as spring-zeebe >= 8.1.9 is released
-->
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_3</artifactId>
</dependency>
<dependency>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-runtime-bundle</artifactId>
Expand All @@ -43,13 +36,29 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.5</version>
<version>1.2.11</version>
<!-- enforce logback version to avoid conflicts with GCP Logging.
Use Spring Boot version, see https://stackoverflow.com/questions/3737992/noclassdeffounderror-org-slf4j-impl-staticloggerbinder
-->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-logging</artifactId>
<version>${version.spring-cloud-gcp-starter-logging}</version>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>${spring-boot.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="com/google/cloud/spring/logging/logback-appender.xml"/>
<include resource="com/google/cloud/spring/logging/logback-json-appender.xml"/>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

<root level="INFO">
<!-- Use CONSOLE_JSON when running on GCP, for local testing use CONSOLE -->
<appender-ref ref="${CAMUNDA_SAAS_LOG_APPENDER:-CONSOLE_JSON}"/>
</root>
<springProfile name="!dev">
<include resource="com/google/cloud/spring/logging/logback-appender.xml"/>
<include resource="com/google/cloud/spring/logging/logback-json-appender.xml"/>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<root level="INFO">
<appender-ref ref="CONSOLE_JSON"/>
</root>
</springProfile>
<springProfile name="dev">
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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 io.camunda.connector.runtime;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest(
classes = SaaSConnectorRuntimeApplication.class,
properties = {"camunda.saas.secrets.projectId=42", "camunda.connector.polling.enabled=false"})
@ActiveProfiles("dev")
public class TestSpringContextStartup {

@Test
public void contextLoaded() {
// This test case just verifies that the runtime comes up without problems around
// conflicting class files in logging or other wired behavior that can be observed
// when the Spring context is initialized (e.g.
// https://github.com/camunda/team-connectors/issues/251)
}
}

0 comments on commit 70b9049

Please sign in to comment.