Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement improvement for customizing logging config #877

Merged
merged 6 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/877.improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added CLI option `--logging-config-file` to enable configuration of custom logs formatting.
2 changes: 2 additions & 0 deletions data/test_invalid_yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
user: user
password: pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 1
disable_existing_loggers: false
formatters:
normalFormatter:
# invalid value
format: None
handlers:
test_handler:
level: INFO
formatter: normalFormatter
class: logging.FileHandler
filename: "logging_test.log"
loggers:
root:
handlers: [test_handler]
level: INFO
rasa:
handlers: [test_handler]
level: INFO
propagate: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 1
disable_existing_loggers: false
formatters:
normalFormatter:
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}"
handlers:
test_handler:
level: INFO
formatter: normalFormatter
class: logging.FileHandler
filename: "logging_test.log"
# invalid unknown key
extra_key: "hello world"
loggers:
root:
handlers: [test_handler]
level: INFO
rasa:
handlers: [test_handler]
level: INFO
propagate: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 1
disable_existing_loggers: false
formatters:
normalFormatter:
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}"
handlers:
test_handler:
# invalid value for level
level: HIGH
formatter: normalFormatter
class: logging.FileHandler
filename: "logging_test.log"
loggers:
root:
handlers: [test_handler]
level: INFO
rasa:
handlers: [test_handler]
level: INFO
propagate: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# missing mandatory key
# version: 1
disable_existing_loggers: false
formatters:
normalFormatter:
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}"
handlers:
test_handler:
level: INFO
formatter: normalFormatter
class: logging.FileHandler
filename: "logging_test.log"
loggers:
root:
handlers: [test_handler]
level: INFO
rasa:
handlers: [test_handler]
level: INFO
propagate: 0
20 changes: 20 additions & 0 deletions data/test_logging_config_files/test_non_existent_handler_id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 1
disable_existing_loggers: false
formatters:
normalFormatter:
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}"
handlers:
test_handler:
level: INFO
formatter: normalFormatter
class: logging.FileHandler
filename: "logging_test.log"
loggers:
root:
# a non-existent handler id
handlers: [some_handler]
level: INFO
rasa:
handlers: [test_handler]
level: INFO
propagate: 0
19 changes: 19 additions & 0 deletions data/test_logging_config_files/test_valid_logging_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 1
disable_existing_loggers: false
formatters:
customFormatter:
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}"
handlers:
test_handler:
level: INFO
formatter: customFormatter
class: logging.FileHandler
filename: "logging_test.log"
loggers:
root:
handlers: [test_handler]
level: INFO
rasa_sdk:
handlers: [test_handler]
level: INFO
propagate: 0
Loading