anchor.diff:  -define(LEVEL_INFO, 2).
   -define(LEVEL_DEBUG, 1).
   
  +-define(DISK_LOGGER, couch_disk_logger).
  +
   -record(state, {
  -    fd,
       level,
       sasl
   }).
   
   debug(Format, Args) ->
       {ConsoleMsg, FileMsg} = get_log_messages(self(), debug, Format, Args),
  -    gen_event:sync_notify(error_logger, {couch_debug, ConsoleMsg, FileMsg}).
  +    ok = disk_log:balog(?DISK_LOGGER, FileMsg),
  +    gen_event:sync_notify(error_logger, {couch_debug, ConsoleMsg}).
   
   info(Format, Args) ->
       {ConsoleMsg, FileMsg} = get_log_messages(self(), info, Format, Args),
  -    gen_event:sync_notify(error_logger, {couch_info, ConsoleMsg, FileMsg}).
  +    ok = disk_log:balog(?DISK_LOGGER, FileMsg),
  +    gen_event:sync_notify(error_logger, {couch_info, ConsoleMsg}).
   
   error(Format, Args) ->
       {ConsoleMsg, FileMsg} = get_log_messages(self(), error, Format, Args),
  -    gen_event:sync_notify(error_logger, {couch_error, ConsoleMsg, FileMsg}).
  +    % Synchronous logging for error messages only. We want to reduce the
  +    % chances of missing any if server is killed.
  +    ok = disk_log:blog(?DISK_LOGGER, FileMsg),
  +    gen_event:sync_notify(error_logger, {couch_error, ConsoleMsg}).
   
   
   level_integer(error)    -> ?LEVEL_ERROR;
  
positive.code:     end,
      ets:insert(?MODULE, {level, Level}),
  
      case file:open(Filename, [append]) of
      {ok, Fd} ->
          {ok, #state{fd = Fd, level = Level, sasl = Sasl}};
      {error, eacces} ->
          {stop, {file_permission_error, Filename}};
      Error ->
          {stop, Error}
      end.
  
negative.code:     ets:insert(?MODULE, {level, NewLevel}),
      {ok, ok, State#state{level = NewLevel}}.
  
  handle_info({disk_log, _Node, _Log, {error_status, Status}}, _State) ->
      io:format("Disk logger error: ~p~n", [Status]),
      % couch_event_sup will restart us.
      remove_handler;
  handle_info(_Info, State) ->
      {ok, State}.
  
  code_change(_OldVsn, State, _Extra) ->
      {ok, State}.
  
  terminate(_Arg, _State) ->
      ok = disk_log:close(?DISK_LOGGER).
  
  get_log_messages(Pid, Level, Format, Args) ->
      ConsoleMsg = unicode:characters_to_binary(io_lib:format(
  