Skip to content

Commit 128b2aa

Browse files
committed
add a logFilenameFormat to server log config
1 parent ea5ad7c commit 128b2aa

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/services/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const getLogPath = () => {
8484

8585
const allLogsFileTransport = new DailyRotateFile({
8686
level: ConfigManagerV2.getInstance().get('server.logLevel') || 'info',
87-
filename: `${getLogPath()}/logs_gateway_app.log.%DATE%`,
87+
filename: `${getLogPath()}/${ConfigManagerV2.getInstance().get('server.logFilenameFormat') || 'logs_gateway_app.log.%DATE%'}`,
8888
datePattern: 'YYYY-MM-DD',
8989
handleExceptions: true,
9090
handleRejections: true,

src/templates/server.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ fastifyLogs: false
2828
# Log level for the application (debug, info, warn, error)
2929
logLevel: debug
3030

31+
32+
# Format of the log filename. %DATE% will be replaced with the current date.
33+
# Recommend changing to logs_gateway_app.%DATE%.log to allow editors to identify the file for syntax highlighting.
34+
logFilenameFormat: logs_gateway_app.log.%DATE%

test/services/data/config-manager-v2/test1/namespace/server-schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"properties": {
55
"certificatePath": { "type": "string" },
66
"logPath": { "type": "string" },
7+
"logFilenameFormat": { "type": "string" },
78
"port": { "type": "integer" },
89
"docsPort": { "type": "integer" },
910
"ipWhitelist": { "type": "array" },

0 commit comments

Comments
 (0)