Skip to content

Commit

Permalink
Merge pull request #612 from tukcomCD2024/develop_back_notification
Browse files Browse the repository at this point in the history
fix : logback update
  • Loading branch information
seokho-1116 authored Aug 4, 2024
2 parents 768489b + 758a45e commit dd928b3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ jobs:
docker ps -q --filter "name=notification" | xargs -r docker stop
docker ps -aq --filter "name=notification" | xargs -r docker rm
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_DOCKER_USER }} --password-stdin ${{ secrets.AWS_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
docker image prune -f
docker image prune -f -a
docker pull ${{ steps.meta.outputs.tags }}
docker run -d -p 8081:8081 -p 9293:9292 -e ENVIRONMENT=prod --name notification --network ec2-user_backend ${{ steps.meta.outputs.tags }}
docker run -d -p 8081:8081 -p 9293:9292 -e ENVIRONMENT=prod -v /home/ec2-user/logs-noti:/logs --name notification --network ec2-user_backend ${{ steps.meta.outputs.tags }}
- name: Remove Github Actions IP from security group
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ jobs:
docker ps -q --filter "name=notification" | xargs -r docker stop
docker ps -aq --filter "name=notification" | xargs -r docker rm
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_TEST_ENV_DOCKER_USER }} --password-stdin ${{ secrets.AWS_TEST_ENV_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
docker image prune -f
docker image prune -f -a
docker pull ${{ steps.meta.outputs.tags }}
docker run -d -p 8081:8081 -e ENVIRONMENT=container --name notification --network test_backend ${{ steps.meta.outputs.tags }}
docker run -d -p 8081:8081 -e ENVIRONMENT=container -v /home/ec2-user/logs-noti:/logs-noti --name notification --network test_backend ${{ steps.meta.outputs.tags }}
- name: Remove Github Actions IP from security group
if: always()
Expand Down
71 changes: 25 additions & 46 deletions backend/notification/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -1,55 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>http://10.0.0.8:3100/loki/api/v1/push</url>
</http>
<format>
<label>
<pattern>app=${name},host=${HOSTNAME},level=%level</pattern>
<readMarkers>true</readMarkers>
</label>
<message>
<pattern>
{
"level":"%level",
"class":"%logger{36}",
"thread":"%thread",
"message": "%message",
"requestId": "%X{X-Request-ID}"
}
</pattern>
</message>
</format>
</appender>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>[%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<appender name="INFO_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>./logs/info.log</file>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %-5level %logger{35} - %msg%n
</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>./logs/info.%d{yyyy-MM-dd}.%i.log.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>
</appender>

<springProfile name="prod">
<logger name="org.hibernate" level="error" additivity="false">
<appender-ref ref="STDOUT"/>
<appender-ref ref="LOKI"/>
</logger>

<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="LOKI"/>
</root>
</springProfile>

<springProfile name="local | dev | container">
<root level="INFO">
<logger name="org.hibernate" level="error" additivity="false">
<appender-ref ref="STDOUT"/>
<appender-ref ref="INFO_LOG"/>
</logger>

<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</springProfile>
<appender-ref ref="INFO_LOG"/>
</root>
</configuration>

0 comments on commit dd928b3

Please sign in to comment.