Github user davisp commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch-log/pull/13#discussion_r71573541
  
    --- Diff: src/couch_log_config_listener.erl ---
    @@ -11,36 +11,46 @@
     % the License.
     
     -module(couch_log_config_listener).
    --vsn(2).
     -behaviour(config_listener).
     
    -% public interface
    --export([subscribe/0]).
    -
    -% config_listener callback
    --export([handle_config_change/5, handle_config_terminate/3]).
    -
    -subscribe() ->
    -    Settings = [
    -        {backend, config:get("log", "backend", "stderr")},
    -        {level, config:get("log", "level", "notice")}
    -    ],
    -    ok = config:listen_for_changes(?MODULE, Settings),
    -    ok.
    -
    -handle_config_change("log", "backend", Value, _, Settings) ->
    -    {level, Level} = lists:keyfind(level, 1, Settings),
    -    couch_log:set_level(Level),
    -    {ok, lists:keyreplace(backend, 1, Settings, {backend, Value})};
    -handle_config_change("log", "level", Value, _, Settings) ->
    -    couch_log:set_level(Value),
    -    {ok, lists:keyreplace(level, 1, Settings, {level, Value})};
    +
    +-export([
    +    start/0
    +]).
    +
    +-export([
    +    handle_config_change/5,
    +    handle_config_terminate/3
    +]).
    +
    +
    +start() ->
    +    ok = config:listen_for_changes(?MODULE, nil).
    +
    +
    +handle_config_change("log", Key, _, _, _) ->
    +    case Key of
    +        "level" ->
    +            couch_log_config:reconfigure();
    +        "max_term_size" ->
    +            couch_log_config:reconfigure();
    +        "max_message_size" ->
    +            couch_log_config:reconfigure();
    +        _ ->
    +            % Someone may have changed the config for
    +            % the writer so we need to re-initialize.
    +            couch_server:reconfigure()
    --- End diff --
    
    Oops, typo, that's supposed to be couch_log_server:reconfigure. Notice that 
the other three are couch_log_config. The difference here is that level, 
max_term_size (which I can delete now) and max_message_size are options that 
are stored in the dynamic module to avoid constant ets table lookups. 
Everything else affects the writer which is in couch_log_server.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to