Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- DEV, PROD: JSON 형식으로 로그 파일 기록 -->
<springProfile name="prod | dev">
<property name="LOG_FILE_PATH" value="/var/log"/>
<property name="LOG_FILE_PATH" value="/var/log/festabook"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Explore repository structure
git ls-files | head -30

Repository: festabook/backend

Length of output: 1102


🏁 Script executed:

# Look for deployment-related files
fd -e dockerfile -e yml -e yaml -e sh | grep -E "(docker|k8s|deploy|infra|script)" | head -20

Repository: festabook/backend

Length of output: 198


🏁 Script executed:

# Check for any directory creation logic related to /var/log/festabook
rg -n "festabook|/var/log" --type-list | head -5

Repository: festabook/backend

Length of output: 450


🏁 Script executed:

# List all configuration and deployment files
fd -e dockerfile -e yml -e yaml -o -name "*docker*" -o -name "*k8s*" -o -name "*deploy*" | head -20

Repository: festabook/backend

Length of output: 291


🏁 Script executed:

# Check the actual logback-spring.xml to understand context
cat -n src/main/resources/logback-spring.xml 2>/dev/null || echo "File not found, searching..."
fd -name "logback-spring.xml"

Repository: festabook/backend

Length of output: 2153


🏁 Script executed:

# Check the start.sh script which likely handles directory setup
cat -n infra/start.sh

Repository: festabook/backend

Length of output: 931


🏁 Script executed:

# Check if directory creation is handled in other infra scripts
cat -n infra/appspec.yml

Repository: festabook/backend

Length of output: 641


🏁 Script executed:

# Check docker-compose.yml for volume or directory setup
cat -n src/main/resources/docker-compose.yml

Repository: festabook/backend

Length of output: 858


🏁 Script executed:

# Search for any mkdir or directory creation logic
rg -n "mkdir.*festabook|festabook.*permission|chown.*festabook" --type shell

Repository: festabook/backend

Length of output: 90


🏁 Script executed:

# Check CI/CD prod workflow
cat -n .github/workflows/ci-cd-prod.yml

Repository: festabook/backend

Length of output: 3395


로그 디렉터리 사전 생성 로직이 배포 파이프라인에 누락되었습니다

더 구체적인 하위 디렉터리로 로그 경로를 조정한 것은 좋은 개선이지만, prod 배포 시 실제로 동작하지 않을 가능성이 높습니다.

문제의 핵심:

RollingFileAppender는 로그 파일이 저장될 디렉터리를 자동으로 생성하지 않습니다. 따라서 /var/log/festabook 디렉터리가 미리 존재하지 않으면:

  • 애플리케이션이 시작되지 않거나
  • 로그를 기록하지 못하고 조용히 실패하거나
  • 런타임 에러가 발생합니다

현재 배포 구조의 문제점:

현재 배포 파이프라인을 살펴보면:

  1. infra/start.sh - JAR만 실행하고 디렉터리 생성 로직이 없음
  2. infra/appspec.yml - ApplicationStart 훅에서 디렉터리 생성 처리 안 함
  3. .github/workflows/ci-cd-prod.yml - 배포 전 사전 준비 단계 없음

해결 방법 (3가지 선택지):

옵션 1: start.sh에서 디렉터리 생성 (가장 간단)

  • 장점: 배포 스크립트 수정만으로 해결, 별도 인프라 변경 불필요
  • 단점: 매 시작 시마다 mkdir 실행 (비효율적이지만 무해함)
mkdir -p /var/log/festabook
sudo chown ubuntu:ubuntu /var/log/festabook

옵션 2: appspec.yml의 BeforeInstall 훅 추가 (권장)

  • 장점: 배포 시 한 번만 실행, 명확한 단계 분리
  • 단점: 새로운 배포 전 준비 스크립트 필요

옵션 3: AWS CodeDeploy 호스트 사전 설정 (인프라 접근 가능 시)

  • 장점: 배포 자동화와 인프라 설정 완전히 분리
  • 단점: 수동 서버 설정 필요, 향후 유지보수 번거로움

이 중 옵션 2를 권장합니다. 배포 자동화 파이프라인이 모든 사전 조건을 처리하도록 설계하는 것이 운영 일관성 면에서 가장 안전합니다.

🤖 Prompt for AI Agents
In src/main/resources/logback-spring.xml around line 5, the LOG_FILE_PATH points
to /var/log/festabook but there is no deployment logic to ensure that directory
exists; add a deployment step to create and set ownership for /var/log/festabook
before the app starts — preferably add a BeforeInstall (or ApplicationStart)
hook in infra/appspec.yml that runs mkdir -p /var/log/festabook and chown to the
service user, or if you cannot change appspec, add the mkdir/chown commands to
infra/start.sh as a fallback; ensure the script runs with sufficient privileges
and that the path matches LOG_FILE_PATH.


<appender name="JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE_PATH}/application.json</file>
Expand Down