質問編集履歴

3

質問の修正

2024/02/16 08:06

投稿

todasan
todasan

スコア78

test CHANGED
File without changes
test CHANGED
@@ -183,10 +183,8 @@
183
183
  current_app.logger.info("【sc001_start】初期表示開始")
184
184
  req = custom_request.Request(title="", data=dict(request.form))
185
185
 
186
- # logging.basicConfig(level=logging.INFO)
187
-
188
186
  ・__init__.py
189
- # ロギング設定
187
+ ロギング設定
190
188
  with open("json/loggingInformation.json", encoding="utf-8") as f:
191
189
  dictConfig(json.load(f))
192
190
 

2

質問の修正

2024/02/16 08:04

投稿

todasan
todasan

スコア78

test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,7 @@
12
12
  │ ├── Dockerfile : Dockerでの設定
13
13
  │ ├── requirements.txt : pipインストールされるPythonの外部モジュール
14
14
  │ └── src
15
+ │ ├──__init__.py
15
16
  │ ├── api.py : オフラインバッチを実行するREST API用のファイル ※追加説明
16
17
  │ ├── batch : バッチ処理一つにつき1ファイルのPythonスクリプトが入るディレクトリ ※ 追加説明
17
18
  │ │ ├── __pycache__ : 説明省略
@@ -182,6 +183,42 @@
182
183
  current_app.logger.info("【sc001_start】初期表示開始")
183
184
  req = custom_request.Request(title="", data=dict(request.form))
184
185
 
186
+ # logging.basicConfig(level=logging.INFO)
187
+
188
+ ・__init__.py
189
+ # ロギング設定
190
+ with open("json/loggingInformation.json", encoding="utf-8") as f:
191
+ dictConfig(json.load(f))
192
+
193
+ ・loggingInformation.json
194
+ {
195
+ "version": 1,
196
+ "formatters": {
197
+ "default": {
198
+ "format": "[%(asctime)s] %(thread)d %(threadName)s %(levelname)-s [%(filename)s:%(lineno)3d] %(message)s"
199
+ }
200
+ },
201
+ "handlers": {
202
+ "wsgi": {
203
+ "class": "logging.StreamHandler",
204
+ "stream": "ext://flask.logging.wsgi_errors_stream",
205
+ "formatter": "default"
206
+ },
207
+ "output_file": {
208
+ "formatter": "default",
209
+ "class": "logging.handlers.RotatingFileHandler",
210
+ "filename": "logs/aplly_logger.log",
211
+ "mode": "a",
212
+ "maxBytes": 1048576,
213
+ "backupCount": 2
214
+ }
215
+ },
216
+ "root": {
217
+ "level": "DEBUG",
218
+ "handlers": ["wsgi", "output_file"]
219
+ }
220
+ }
221
+
185
222
  ### 補足
186
223
  docker環境で、ビルド、ラン後に、
187
224
  以下のsc001.pyの画面には来ています。

1

質問の修正

2024/02/16 04:51

投稿

todasan
todasan

スコア78

test CHANGED
File without changes
test CHANGED
@@ -3,8 +3,6 @@
3
3
 
4
4
  ### 発生している問題・分からないこと
5
5
  /app/src/logs
6
-
7
-
8
6
 
9
7
  ### 該当のソースコード
10
8
 
@@ -71,12 +69,6 @@
71
69
  │ │ └── sc033 : 画面処理ID「sc033_01」と「sc033_02」共通のテンプレートディレクトリ
72
70
  │ │ └── codeID_form.html
73
71
  ├── docker-compose.yml
74
- ├── docs
75
- │ ├── PSQL�\203��\203�.md
76
- │ ├── images
77
- │ ├── �\203��\203�.md
78
- │ ├── 帳票�\234�\210\220.md
79
- │ └── �\226\213�\231��\203��\203�.md
80
72
  └── web
81
73
  ├── Dockerfile
82
74
  └── httpd
@@ -92,10 +84,12 @@
92
84
  - apply_network
93
85
  volumes:
94
86
  - type: bind
95
- source: "C:/Users/pcuser/source_code/apply_jinji/app/flask_test_jisshi" # ログファイル出力ディレクトリの設定。開発時にはローカルPC上の任意のディレクトリを指定
87
+ source: "C:/Users/pcuser/source_code/apply_jinji/app/flask_test_jisshi"
88
+ # ログファイル出力ディレクトリの設定。開発時にはローカルPC上の任意のディレクトリを指定
96
89
  target: "/app/src/logs"
97
90
  - type: bind
98
- source: "C:/Users/pcuser/source_code/apply_jinji/app/src" # Flaskディレクトリの設定。開発時にはローカルPC上の apply_jinji/app/src/ ディレクトリを指定
91
+ source: "C:/Users/pcuser/source_code/apply_jinji/app/src"
92
+ # Flaskディレクトリの設定。開発時にはローカルPC上の apply_jinji/app/src/ ディレクトリを指定
99
93
  target: "/app/src/"
100
94
  environment:
101
95
  TZ: Asia/Tokyo
@@ -107,7 +101,8 @@
107
101
  - 80:80
108
102
  volumes:
109
103
  - type: bind
110
- source: "C:/Users/pcuser/source_code/apply_jinji/app/apache_output" # Apacheログ出力先ディレクトリの設定。開発時にはローカルPC上の任意のディレクトリを指定
104
+ source: "C:/Users/pcuser/source_code/apply_jinji/app/apache_output"
105
+ # Apacheログ出力先ディレクトリの設定。開発時にはローカルPC上の任意のディレクトリを指定
111
106
  target: "/var/log/apache2"
112
107
  environment:
113
108
  TZ: Asia/Tokyo