Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
prenagha committed Aug 15, 2024
1 parent 16661c5 commit 040096e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-jetty")
implementation("org.springframework.boot:spring-boot-configuration-processor")

implementation("de.siegmar:logback-awslogs-json-encoder:2.0.1")

// monitoring endpoints
implementation("org.springframework.boot:spring-boot-starter-actuator")

Expand Down
25 changes: 25 additions & 0 deletions app/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

<appender name="JSON" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="de.siegmar.logbackawslogsjsonencoder.AwsJsonLogEncoder"/>
</appender>

<springProfile name="dev">
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>

<springProfile name="aws">
<root level="INFO">
<appender-ref ref="JSON"/>
</root>
<logger name="org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler" level="INFO"/>
<logger name="org.springframework.web.SimpLogging" level="INFO"/>
<logger name="org.springframework.web.socket.config.WebSocketMessageBrokerStats" level="WARN"/>
</springProfile>
</configuration>
8 changes: 3 additions & 5 deletions cdk/src/main/java/com/renaghan/todo/cdk/ServiceApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.stratospheric.cdk.Network;
import dev.stratospheric.cdk.Service;
import java.util.HashMap;
import java.util.Map;
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
Expand All @@ -28,21 +29,18 @@ public static void main(String[] args) {
Network.getOutputParametersFromParameterStore(
serviceStack, app.appEnv().getEnvironmentName());

Map<String, String> vars = new HashMap<>();
vars.put("SPRING_PROFILES_ACTIVE", app.getContext("springProfile"));
/*
CognitoStack.CognitoOutputParameters cognitoOutputParameters =
CognitoStack.getOutputParametersFromParameterStore(serviceStack, app.appEnv());
Map<String, String> vars =
environmentVariables(app.getContext("springProfile"), cognitoOutputParameters);
vars.put("SPRING_PROFILES_ACTIVE", springProfile);
vars.put("COGNITO_CLIENT_ID", cognitoOutputParameters.userPoolClientId());
vars.put("COGNITO_CLIENT_SECRET", cognitoOutputParameters.userPoolClientSecret());
vars.put("COGNITO_USER_POOL_ID", cognitoOutputParameters.userPoolId());
vars.put("COGNITO_LOGOUT_URL", cognitoOutputParameters.logoutUrl());
vars.put("COGNITO_PROVIDER_URL", cognitoOutputParameters.providerUrl());
*/

Map<String, String> vars = Map.of();

Service.ServiceInputParameters inputParameters =
new Service.ServiceInputParameters(
new Service.DockerImageSource(
Expand Down

0 comments on commit 040096e

Please sign in to comment.