-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ee1933
commit 7b14de3
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## 빌드 | ||
docker build -t whatap/kube_python_django:0.0.1 | ||
|
||
## 실행 | ||
docker run -d -p 8000:8000 \ | ||
-e license=x41pl22ek7jhv-z43cebasdv4il7-z62p3l35fj5502 \ | ||
-e whatap_server_host=15.165.146.117 \ | ||
-e app_name=test-django \ | ||
-e app_process_name=python \ | ||
whatap/kube_python_django:0.0.1 | ||
|
||
docker ps | grep whatap/kube_python_django:0.0.1 | ||
|
||
docker exec -it {container id} /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import logging | ||
from src.utils import get_project_dir | ||
|
||
project_dir = get_project_dir() | ||
try: | ||
import whatap.trace.mod.logging as whatap_logging | ||
if whatap_logging.loguru_injection_processed: | ||
# whatap 모니터링 사용하는 경우 | ||
FORMAT = '%(module)s.%(funcName)s - %(message)s - %(levelname)s - %(asctime)s %(lineno)s -- {{ "@txid" : "{txid}" }} -- ' | ||
else: | ||
# whatap 모니터링 사용, loguru injection (x) | ||
FORMAT = '%(module)s.%(funcName)s - %(message)s - %(levelname)s - %(asctime)s %(lineno)s' | ||
except: | ||
# whatap 모니터링 사용하지 않는 경우 | ||
FORMAT = '%(module)s.%(funcName)s - %(message)s - %(levelname)s - %(asctime)s %(lineno)s' | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.DEBUG) | ||
logger.propagate = False | ||
|
||
# 로그를 콘솔에 출력하는 Handler | ||
stream_handler = logging.StreamHandler() | ||
stream_handler.setLevel(logging.DEBUG) | ||
STREAM_FORMAT = FORMAT | ||
stream_log_formatter = logging.Formatter(STREAM_FORMAT) | ||
stream_handler.setFormatter(stream_log_formatter) | ||
logger.addHandler(stream_handler) | ||
|
||
|
||
##File handler | ||
filename = f"{project_dir}/app_logs/app.log" | ||
file_handler = logging.FileHandler(filename=filename, mode="a") | ||
file_handler.setLevel(logging.INFO) | ||
FORMAT = FORMAT | ||
file_log_formatter = logging.Formatter(FORMAT) | ||
file_handler.setFormatter(file_log_formatter) | ||
logger.addHandler(file_handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters