[
https://issues.apache.org/jira/browse/COUCHDB-2970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Shorin resolved COUCHDB-2970.
---------------------------------------
Resolution: Fixed
Assignee: Jay Doane
Fix Version/s: 2.0.0
> 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
> Assignee: Jay Doane
> Fix For: 2.0.0
>
>
> 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}
> ([email protected])26> config:get("log","level").
> "info"
> ([email protected])27> gen_event:which_handlers(lager_event).
> [{lager_file_backend,"/var/log/cloudant/cloudant.log"},
> lager_backend_throttle]
> ([email protected])28>
> lager:get_loglevel({lager_file_backend,"/var/log/cloudant/cloudant.log"}).
> info
> ([email protected])29> config:set("log","level","notice",false).
> ok
> ([email protected])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}
> ([email protected])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"]}]}]}
> ([email protected])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)