File tree Expand file tree Collapse file tree 4 files changed +61
-0
lines changed Expand file tree Collapse file tree 4 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ package logs
2
+
3
+ const S3WORKER_LOGGING = `version: 1
4
+ disable_existing_loggers: false
5
+
6
+ formatters:
7
+ verbose:
8
+ format: '%(levelname)s %(asctime)s %(module)s %(message)s'
9
+
10
+ handlers:
11
+ console:
12
+ class: logging.StreamHandler
13
+ formatter: verbose
14
+
15
+ loggers:
16
+ celery:
17
+ level: DEBUG
18
+ handlers: [console]
19
+ s3worker:
20
+ level: DEBUG
21
+ handlers: [console]
22
+ propagate: no
23
+ `
Original file line number Diff line number Diff line change
1
+ package logs
2
+
3
+ const WEBAPP_LOGGING = `version: 1
4
+ disable_existing_loggers: false
5
+
6
+ formatters:
7
+ verbose:
8
+ format: '%(levelname)s %(asctime)s %(module)s %(message)s'
9
+
10
+ handlers:
11
+ console:
12
+ class: logging.StreamHandler
13
+ formatter: verbose
14
+
15
+ loggers:
16
+ papermerge.core.tasks:
17
+ level: DEBUG
18
+ handlers: [console]
19
+ propagate: no
20
+ `
Original file line number Diff line number Diff line change 6
6
"text/template"
7
7
8
8
"github.com/papermerge/pmcompose/ask"
9
+ "github.com/papermerge/pmcompose/logs"
9
10
"github.com/papermerge/pmcompose/utils"
10
11
)
11
12
@@ -100,4 +101,17 @@ func main() {
100
101
}
101
102
102
103
fmt .Println ("✅ docker-compose.yml generated successfully." )
104
+
105
+ err = os .WriteFile ("webapp_logging.yaml" , []byte (logs .WEBAPP_LOGGING ), 0644 )
106
+ if err != nil {
107
+ fmt .Println ("Error writing webapp_logging.yaml file" )
108
+ }
109
+
110
+ if cfg .S3StorageBackend .S3BucketName != "" {
111
+ err = os .WriteFile ("s3worker_logging.yaml" , []byte (logs .S3WORKER_LOGGING ), 0644 )
112
+ if err != nil {
113
+ fmt .Println ("Error writing s3worker_logging.yaml file" )
114
+ }
115
+ }
116
+
103
117
}
Original file line number Diff line number Diff line change @@ -8,13 +8,15 @@ services:
8
8
PAPERMERGE__DATABASE__URL: postgresql://coco:jumbo@db:5432/pmgdb
9
9
PAPERMERGE__REDIS__URL: redis://redis:6379/0
10
10
PAPERMERGE__MAIN__MEDIA_ROOT: /var/media/pmg
11
+ PAPERMERGE__MAIN__LOGGING_CFG: /etc/papermerge/logging.yaml
11
12
ports:
12
13
- "{{ .WebAppPort }}:80"
13
14
depends_on:
14
15
- db
15
16
- redis
16
17
volumes:
17
18
- media_root:/var/media/pmg
19
+ - ${PWD}/webapp_logging.yaml:/etc/papermerge/logging.yaml
18
20
path_template_worker:
19
21
image: papermerge/path-tmpl-worker:0.4
20
22
command: worker
@@ -34,6 +36,7 @@ services:
34
36
PAPERMERGE__REDIS__URL: redis://redis:6379/0
35
37
PAPERMERGE__MAIN__MEDIA_ROOT: /var/media/pmg
36
38
PAPERMERGE__S3__BUCKET_NAME: {{ .S3StorageBackend.S3BucketName }}
39
+ PAPERMERGE__MAIN__LOGGING_CFG: /etc/papermerge/logging.yaml
37
40
S3_WORKER_ARGS: "-Q s3 -c 2"
38
41
AWS_REGION_NAME: {{ .S3StorageBackend.AWSRegionName }}
39
42
AWS_ACCESS_KEY_ID: {{ .S3StorageBackend.AWSAccessKeyID }}
@@ -43,6 +46,7 @@ services:
43
46
- redis
44
47
volumes:
45
48
- media_root:/var/media/pmg
49
+ - ${PWD}/s3worker_logging.yaml:/etc/papermerge/logging.yaml
46
50
{{- end }}
47
51
db:
48
52
image: postgres:16.1
You can’t perform that action at this time.
0 commit comments