You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Jay Doane (JIRA)" <ji...@apache.org> on 2016/03/17 01:29:33 UTC
[jira] [Created] (COUCHDB-2970) config:set("log","level",...) fails
to change lager backend levels
Jay Doane created COUCHDB-2970:
----------------------------------
Summary: config:set("log","level",...) fails to change lager backend levels
Key: COUCHDB-2970
URL: https://issues.apache.org/jira/browse/COUCHDB-2970
Project: CouchDB
Issue Type: Bug
Components: Logging
Reporter: Jay Doane
The following remsh session shows that at first, both config log level and lager_file_backend levels are the same (info), but after we use config to change the level to notice, the lager level remains at info:
{code}
(cloudant@db1.v)26> config:get("log","level").
"info"
(cloudant@db1.v)27> gen_event:which_handlers(lager_event).
[{lager_file_backend,"/var/log/cloudant/cloudant.log"},
lager_backend_throttle]
(cloudant@db1.v)28> lager:get_loglevel({lager_file_backend,"/var/log/cloudant/cloudant.log"}).
info
(cloudant@db1.v)29> config:set("log","level","notice",false).
ok
(cloudant@db1.v)30> lager:get_loglevel({lager_file_backend,"/var/log/cloudant/cloudant.log"}).
info
{code}
The problem occurs because https://github.com/apache/couchdb-couch-log-lager/blob/master/src/couch_log_lager.erl#L67 obtains the handlers from application:get_env(lager, handlers), which returns the a structure defined in sys.config, but it should use gen_event:which_handlers(lager_event), which returns the actual list of handlers:
{code}
(cloudant@db1.v)31> application:get_env(lager, handlers). {ok,[{lager_file_backend,
[{file,"/var/log/cloudant/cloudant.log"},
{formatter,lager_default_formatter},
{formatter_config,
[date," ",time," [",severity,"] ",node," ",pid," ",message,
"\n"]}]}]}
(cloudant@db1.v)32> gen_event:which_handlers(lager_event). [{lager_file_backend,"/var/log/cloudant/cloudant.log"},
lager_backend_throttle]
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)