CB Spider 서버 로그출력 환경 설정 방법 (Korean) - cloud-barista/cb-spider GitHub Wiki
CB-Spider 서버 로그출력 환경 설정 방법
CB-Spider 로그출력은 cb-log (Cloud-Barista 공통 로그 관리 라이브러리) 를 활용하고 있으며, 세부 설정 방법은 다음과 같다.
1. 설정 파일: $CBLOG_ROOT/conf/log_conf.yaml
2. 적용 방법: 서버 재가동 또는 자동 반영(loopcheck=true 설정시)
3. 설정 정보:
Configurations | Descriptions | Default |
---|---|---|
loopcheck | 설정값 변경시 자동 반영 여부 설정. 설정값: true, false | false |
loglevel | 로그 레벨 설정. 설정값: trace, debug, info, warn, error, fatal, panic | error |
logfile | 로그 파일 출력 여부 설정. 설정값: true, false | true |
logfileinfo: | ----- 이하 logfile true 일때 유효 ----- | |
filename | 로그를 저장할 파일 path 및 이름. 설정값: {path}logfilename | ./log/cblogs.log |
maxsize | 개별 로그 파일 크기. 설정값: integer #megabytes | 10 |
maxbackups | 로그 파일 개수. 설정값: integer #number | 50 |
maxage | 로그 파일 유지 기간. 설정값: integer #days | 31 |
4. 설정 예시
$ vi $CBLOG_ROOT/conf/log_conf.yaml
#### Config for CB-Log Lib. ####
cblog:
## true | false
loopcheck: false # This temp method for development is busy wait. cf) cblogger.go:levelSetupLoop().
## trace | debug | info | warn/warning | error | fatal | panic
loglevel: error # If loopcheck is true, You can set this online.
## true | false
logfile: true
## Config for File Output ##
logfileinfo:
filename: ./log/cblogs.log
maxsize: 10 # megabytes
maxbackups: 50
maxage: 31 # days
5. 환경 변수 이용한 Log Level 설정
- v0.8.14부터 활용 가능
- 환경 변수 설정은
log_conf.yaml
설정보다 우선순위가 높다. Log Level
은 환경 변수 설정을 이용하여 다음과 같이 설정 가능하다.export SPIDER_LOG_LEVEL=panic export SPIDER_HISCALL_LOG_LEVEL=error # HisCall Log Level 설정
- 사용 가능한 Log Level Options
* SPIDER_LOG_LEVEL: trace | debug | info | warn/warning | error | fatal | panic * SPIDER_HISCALL_LOG_LEVEL: info | error # HisCall Log Level 설정
- 사용 가능한 Log Level Options
- Docker 기반 Spider 활용시 Log Level 설정 방법 참고
- Docker-based Start Guide:
Start CB-Spider Server with the Log Level Setup
- Docker-based Start Guide: