logging.config.fileConfig yields no logs
I'm trying to configure my logging for a flask app, and to do so I need to use logging.config.dictConfig()
because I need to specify a filter. Before I need a filter I was using logging.config.fileConfig()
and everything worked fine. But now, I've changed to a dict and config and none of my logs show up anywhere. It's like the the dictionary configuration is just being completely ignored. I don't know what I'm doing wrong, since I don't get any errors. This is what my original logging configuration looked like:
[loggers]
keys=root,rasa_core.agent,rasa_core.tracker_store,rasa_core.processor,test,run
[handlers]
keys=rootHandler,agentHandler,trackerHandler,convHandler,testHandler
[formatters]
keys=basic
[logger_root]
level=NOTSET
handlers=rootHandler
[logger_rasa_core.agent]
level=NOTSET
handlers=agentHandler
qualname=rasa_core.agent
[logger_rasa_core.tracker_store]
level=NOTSET
handlers=trackerHandler
qualname=rasa_core.tracker_store
[logger_rasa_core.processor]
level=NOTSET
handlers=convHandler
qualname=rasa_core.processor
[logger_test]
level=NOTSET
handlers=testHandler
qualname=my_app.trainer_app.routes
[logger_run]
level=NOTSET
handlers=rootHandler
qualname=__main__
[handler_rootHandler]
class=StreamHandler
level=INFO
formatter=basic
args=(sys.stdout,)
[handler_agentHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/agent.log', 'a')
[handler_trackerHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/tracker.log', 'a')
[handler_convHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/conv.log', 'a')
[handler_testHandler]
class=StreamHandler
level=NOTSET
formatter=basic
args=(sys.stdout,)
[formatter_basic]
format=%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - %(threadName)s - %(message)s
and here is the new dictionary configuration:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - Session:%(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
}
},
'loggers': {
'root': {
'level': 'NOTSET',
'handlers': ['rootHandler', 'testHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
This is the code where I load in the configuration:
import sys
import logging
from my_app.logging.dict_config import CONFIG
from my_app.trainer_app import routes
from my_app.trainer_app.app import app, app_config
from my_app.trainer_app.cherry import run_cp
print(CONFIG)
logging.config.dictConfig(CONFIG)
logger = logging.getLogger(__name__)
# logging.config.fileConfig(fname='my_app/config/logging.conf')
I commented out the original logging.config.fileConfig
to show where it was originally.
I really don't understand why the original logging configuration would work fine, but this new one just does nothing.
python dictionary logging flask
add a comment |
I'm trying to configure my logging for a flask app, and to do so I need to use logging.config.dictConfig()
because I need to specify a filter. Before I need a filter I was using logging.config.fileConfig()
and everything worked fine. But now, I've changed to a dict and config and none of my logs show up anywhere. It's like the the dictionary configuration is just being completely ignored. I don't know what I'm doing wrong, since I don't get any errors. This is what my original logging configuration looked like:
[loggers]
keys=root,rasa_core.agent,rasa_core.tracker_store,rasa_core.processor,test,run
[handlers]
keys=rootHandler,agentHandler,trackerHandler,convHandler,testHandler
[formatters]
keys=basic
[logger_root]
level=NOTSET
handlers=rootHandler
[logger_rasa_core.agent]
level=NOTSET
handlers=agentHandler
qualname=rasa_core.agent
[logger_rasa_core.tracker_store]
level=NOTSET
handlers=trackerHandler
qualname=rasa_core.tracker_store
[logger_rasa_core.processor]
level=NOTSET
handlers=convHandler
qualname=rasa_core.processor
[logger_test]
level=NOTSET
handlers=testHandler
qualname=my_app.trainer_app.routes
[logger_run]
level=NOTSET
handlers=rootHandler
qualname=__main__
[handler_rootHandler]
class=StreamHandler
level=INFO
formatter=basic
args=(sys.stdout,)
[handler_agentHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/agent.log', 'a')
[handler_trackerHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/tracker.log', 'a')
[handler_convHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/conv.log', 'a')
[handler_testHandler]
class=StreamHandler
level=NOTSET
formatter=basic
args=(sys.stdout,)
[formatter_basic]
format=%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - %(threadName)s - %(message)s
and here is the new dictionary configuration:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - Session:%(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
}
},
'loggers': {
'root': {
'level': 'NOTSET',
'handlers': ['rootHandler', 'testHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
This is the code where I load in the configuration:
import sys
import logging
from my_app.logging.dict_config import CONFIG
from my_app.trainer_app import routes
from my_app.trainer_app.app import app, app_config
from my_app.trainer_app.cherry import run_cp
print(CONFIG)
logging.config.dictConfig(CONFIG)
logger = logging.getLogger(__name__)
# logging.config.fileConfig(fname='my_app/config/logging.conf')
I commented out the original logging.config.fileConfig
to show where it was originally.
I really don't understand why the original logging configuration would work fine, but this new one just does nothing.
python dictionary logging flask
add a comment |
I'm trying to configure my logging for a flask app, and to do so I need to use logging.config.dictConfig()
because I need to specify a filter. Before I need a filter I was using logging.config.fileConfig()
and everything worked fine. But now, I've changed to a dict and config and none of my logs show up anywhere. It's like the the dictionary configuration is just being completely ignored. I don't know what I'm doing wrong, since I don't get any errors. This is what my original logging configuration looked like:
[loggers]
keys=root,rasa_core.agent,rasa_core.tracker_store,rasa_core.processor,test,run
[handlers]
keys=rootHandler,agentHandler,trackerHandler,convHandler,testHandler
[formatters]
keys=basic
[logger_root]
level=NOTSET
handlers=rootHandler
[logger_rasa_core.agent]
level=NOTSET
handlers=agentHandler
qualname=rasa_core.agent
[logger_rasa_core.tracker_store]
level=NOTSET
handlers=trackerHandler
qualname=rasa_core.tracker_store
[logger_rasa_core.processor]
level=NOTSET
handlers=convHandler
qualname=rasa_core.processor
[logger_test]
level=NOTSET
handlers=testHandler
qualname=my_app.trainer_app.routes
[logger_run]
level=NOTSET
handlers=rootHandler
qualname=__main__
[handler_rootHandler]
class=StreamHandler
level=INFO
formatter=basic
args=(sys.stdout,)
[handler_agentHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/agent.log', 'a')
[handler_trackerHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/tracker.log', 'a')
[handler_convHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/conv.log', 'a')
[handler_testHandler]
class=StreamHandler
level=NOTSET
formatter=basic
args=(sys.stdout,)
[formatter_basic]
format=%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - %(threadName)s - %(message)s
and here is the new dictionary configuration:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - Session:%(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
}
},
'loggers': {
'root': {
'level': 'NOTSET',
'handlers': ['rootHandler', 'testHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
This is the code where I load in the configuration:
import sys
import logging
from my_app.logging.dict_config import CONFIG
from my_app.trainer_app import routes
from my_app.trainer_app.app import app, app_config
from my_app.trainer_app.cherry import run_cp
print(CONFIG)
logging.config.dictConfig(CONFIG)
logger = logging.getLogger(__name__)
# logging.config.fileConfig(fname='my_app/config/logging.conf')
I commented out the original logging.config.fileConfig
to show where it was originally.
I really don't understand why the original logging configuration would work fine, but this new one just does nothing.
python dictionary logging flask
I'm trying to configure my logging for a flask app, and to do so I need to use logging.config.dictConfig()
because I need to specify a filter. Before I need a filter I was using logging.config.fileConfig()
and everything worked fine. But now, I've changed to a dict and config and none of my logs show up anywhere. It's like the the dictionary configuration is just being completely ignored. I don't know what I'm doing wrong, since I don't get any errors. This is what my original logging configuration looked like:
[loggers]
keys=root,rasa_core.agent,rasa_core.tracker_store,rasa_core.processor,test,run
[handlers]
keys=rootHandler,agentHandler,trackerHandler,convHandler,testHandler
[formatters]
keys=basic
[logger_root]
level=NOTSET
handlers=rootHandler
[logger_rasa_core.agent]
level=NOTSET
handlers=agentHandler
qualname=rasa_core.agent
[logger_rasa_core.tracker_store]
level=NOTSET
handlers=trackerHandler
qualname=rasa_core.tracker_store
[logger_rasa_core.processor]
level=NOTSET
handlers=convHandler
qualname=rasa_core.processor
[logger_test]
level=NOTSET
handlers=testHandler
qualname=my_app.trainer_app.routes
[logger_run]
level=NOTSET
handlers=rootHandler
qualname=__main__
[handler_rootHandler]
class=StreamHandler
level=INFO
formatter=basic
args=(sys.stdout,)
[handler_agentHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/agent.log', 'a')
[handler_trackerHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/tracker.log', 'a')
[handler_convHandler]
class=FileHandler
level=NOTSET
formatter=basic
args=('my_app/logs/conv.log', 'a')
[handler_testHandler]
class=StreamHandler
level=NOTSET
formatter=basic
args=(sys.stdout,)
[formatter_basic]
format=%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - %(threadName)s - %(message)s
and here is the new dictionary configuration:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - %(funcName)s - %(pathname)s - Session:%(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'maxBytes': 1024,
'backupCount': 3,
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
}
},
'loggers': {
'root': {
'level': 'NOTSET',
'handlers': ['rootHandler', 'testHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
This is the code where I load in the configuration:
import sys
import logging
from my_app.logging.dict_config import CONFIG
from my_app.trainer_app import routes
from my_app.trainer_app.app import app, app_config
from my_app.trainer_app.cherry import run_cp
print(CONFIG)
logging.config.dictConfig(CONFIG)
logger = logging.getLogger(__name__)
# logging.config.fileConfig(fname='my_app/config/logging.conf')
I commented out the original logging.config.fileConfig
to show where it was originally.
I really don't understand why the original logging configuration would work fine, but this new one just does nothing.
python dictionary logging flask
python dictionary logging flask
asked Jan 3 at 17:03
matt_jsmatt_js
1471111
1471111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I figured it out. For some reason, root logger is denoted with ''
instead of the name 'root'
as it is in a file configuration. Using this file fixed the issue:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - Session: %(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'testHandlerNoFilter': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout'
}
},
'loggers': {
'': {
'level': 'NOTSET',
'handlers': ['rootHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
The only important difference is that I replaced 'root'
with ''
. Any other differences are irrelevant to this question.
add a comment |
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54026694%2flogging-config-fileconfig-yields-no-logs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I figured it out. For some reason, root logger is denoted with ''
instead of the name 'root'
as it is in a file configuration. Using this file fixed the issue:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - Session: %(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'testHandlerNoFilter': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout'
}
},
'loggers': {
'': {
'level': 'NOTSET',
'handlers': ['rootHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
The only important difference is that I replaced 'root'
with ''
. Any other differences are irrelevant to this question.
add a comment |
I figured it out. For some reason, root logger is denoted with ''
instead of the name 'root'
as it is in a file configuration. Using this file fixed the issue:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - Session: %(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'testHandlerNoFilter': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout'
}
},
'loggers': {
'': {
'level': 'NOTSET',
'handlers': ['rootHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
The only important difference is that I replaced 'root'
with ''
. Any other differences are irrelevant to this question.
add a comment |
I figured it out. For some reason, root logger is denoted with ''
instead of the name 'root'
as it is in a file configuration. Using this file fixed the issue:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - Session: %(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'testHandlerNoFilter': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout'
}
},
'loggers': {
'': {
'level': 'NOTSET',
'handlers': ['rootHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
The only important difference is that I replaced 'root'
with ''
. Any other differences are irrelevant to this question.
I figured it out. For some reason, root logger is denoted with ''
instead of the name 'root'
as it is in a file configuration. Using this file fixed the issue:
CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '%(asctime)s - %(levelname)s - Session: %(session_id)s - %(message)s'
}
},
'handlers': {
'rootHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'agentHandler' :{
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/agent.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'trackerHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/tracker.log',
'formatter': 'standard',
'filters': ['sessionFilter']
},
'convHandler': {
'class': 'logging.FileHandler',
'level': 'NOTSET',
'filename': 'my_app/logs/conv.log',
'formatter': 'standard',
'filters': ['sessionFilter'],
},
'testHandler': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout',
'filters': ['sessionFilter']
},
'testHandlerNoFilter': {
'class': 'logging.StreamHandler',
'level': 'NOTSET',
'formatter': 'standard',
'stream': 'ext://sys.stdout'
}
},
'loggers': {
'': {
'level': 'NOTSET',
'handlers': ['rootHandler']
},
'rasa_core.agent': {
'level': 'NOTSET',
'handlers': ['agentHandler'],
},
'rasa_core.tracker_store': {
'level': 'NOTSET',
'handlers': ['trackerHandler'],
},
'rasa_core.processor': {
'level': 'NOTSET',
'handlers': ['convHandler', 'testHandler'],
},
'my_app.trainer_app.routes': {
'level': 'NOTSET',
'handlers': ['testHandler'],
}
},
'filters': {
'sessionFilter': {
'()': 'my_app.logging.filters.SessionFilter'
}
},
'disable_existing_loggers': False
}
The only important difference is that I replaced 'root'
with ''
. Any other differences are irrelevant to this question.
answered Jan 3 at 18:17
matt_jsmatt_js
1471111
1471111
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54026694%2flogging-config-fileconfig-yields-no-logs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown