[erlang-questions] lager and dynamic log cutting via compiled module

Ulf Wiger <>
Sat Aug 24 17:45:09 CEST 2013


The loglevel check is done using mochiglobal:

%% @doc Set the loglevel for a particular backend.
set_loglevel(Handler, Level) when is_atom(Level) ->
    Reply = gen_event:call(lager_event, Handler, {set_loglevel, Level}, infinity),
    %% recalculate min log level
    MinLog = minimum_loglevel(get_loglevels()),
    {_, Traces} = lager_mochiglobal:get(loglevel),
    lager_mochiglobal:put(loglevel, {MinLog, Traces}),
    Reply.

Basho switched to an ets table in this pull request:

https://github.com/basho/lager/pull/88

"Replace mochiglobal with a public ETS table

This also removes the dependency on the syntax_tools and compiler
applications, which interfered with lager's startup/shutdown order.

I've benchmarked this with logbench, and performance doesn't seem to differ significantly from the mochiglobal version, and has much less baggage associated with it."

BR,
Ulf W

On 24 Aug 2013, at 17:17, Max Lapshin <> wrote:

> It is not so clear for me: do you generate a proxy module on config loading or you make a parse_transform of code that uses lager:debug(..) ?

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130824/f0f7eb2e/attachment.html>


More information about the erlang-questions mailing list