log4erl:change_level/3 doesn't work

2 views
Skip to first unread message

odi

unread,
Feb 1, 2010, 9:41:27 AM2/1/10
to Log4erl
log4erl:change_level function for appender is sent with gen_event:call/
3 but there's no matching handle_call clause in file_appender or
console_appender.
Greetings,
Kuba

Ahmed Ali

unread,
Feb 1, 2010, 11:23:06 AM2/1/10
to log...@googlegroups.com, kuba....@gmail.com
Hi Odi,

Can you please explain the error you get as well as versions of
log4erl and erlang you're using?

I've just checked the latest version 0.8.6 and see that this is not
true. I suspect you're looking at the wrong function in appenders.
change_level messages are handled in handle_event/2 function in
appenders not in handle_call/2. In general, all messages to appenders
are sent as events (to be handled by handle_event/2 in appenders)
except for changing format, which is a call (to be handled by
handle_call/2).

I hope this clarifies any misunderstanding.

BTW, I've just released last night a new version of log4erl (v. 0.9),
which includes all updates done by Dilshod Temirkhodjaev, David
Dossot, and Ken Pratt (from their github repos) as well as some
enhancements and bug fixes. I'm currently writing documentation for
this release and then will offecially announce it. However, you can
download the latest updates from log4erl's github repo and use it.
This is not yet in googe's code.

Best regards,

Ahmed

> --
> You received this message because you are subscribed to the Google Groups "Log4erl" group.
> To post to this group, send email to log...@googlegroups.com.
> To unsubscribe from this group, send email to log4erl+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/log4erl?hl=en.
>
>

Ahmed Ali

unread,
Feb 2, 2010, 11:50:08 AM2/2/10
to Kuba Odias, log...@googlegroups.com
Hi Kuba,

You're right. There's a bug in all appenders regarding changing
appender's log level. I've just finished testing the correction. It'll
be updated in github's repo today or tomorrow. You'll have to upgrade
to version 0.9 though for this fix. I hope this is fine with you.

Regards,

Ahmed

On Tue, Feb 2, 2010 at 12:09 PM, Kuba Odias <kuba....@gmail.com> wrote:
> Hi again,
> To reproduce this error I used following steps in version 0.8.6:
>
> 1> application:start(log4erl).
> ok
> 2> sys:get_status(default_logger).
> {status,<0.37.0>,
>        {module,gen_event},
>        [[{'$ancestors',[log4erl_sup,<0.34.0>]},
>          {'$initial_call',{gen_event,init_it,6}}],
>         running,<0.35.0>,[],
>         [default_logger,[],false]]}
> 3> log4erl:add_console_appender(console, {info, "%l%n"}).
> {ok,<0.40.0>}
> 4> sys:get_status(default_logger).
> {status,<0.37.0>,
>        {module,gen_event},
>        [[{'$ancestors',[log4erl_sup,<0.34.0>]},
>          {'$initial_call',{gen_event,init_it,6}}],
>         running,<0.35.0>,[],
>         [default_logger,
>          [{handler,console_appender,console,
>                    {console_appender,info,[log,new_line]},
>                    <0.40.0>}],
>          false]]}
> 5> log4erl:info("1").
> 1
> ok
> 6> log4erl:debug("2").
> ok
> 7> log4erl:change_level(default_logger, console, debug).
> ok
> 8> sys:get_status(default_logger).
> {status,<0.37.0>,
>        {module,gen_event},
>        [[{'$ancestors',[log4erl_sup,<0.34.0>]},
>          {'$initial_call',{gen_event,init_it,6}}],
>         running,<0.35.0>,[],
>         [default_logger,
>          [{handler,console_appender,console,
>                    {console_appender,info,[log,new_line]},
>                    <0.40.0>}],
>          false]]}
> 9> log4erl:info("3").
> 3
> ok
> 10> log4erl:debug("4").
> ok
>
> As you can see log level wasn't changed.
> Regards,
> Kuba
>
> 2010/2/1 Kuba Odias <kuba....@gmail.com>:
>> hi,
>> I'm using log4erl-0.8.6 and erlang5.7.3. I checked it today and it
>> didn't work correctly when using change_level to change single
>> appender's level, change_log_level worked fine but it changed log
>> level for all appenders. I'll recheck it tomorrow at work;)
>> Thanks for the reply,
>> Kuba
>>
>> 2010/2/1 Ahmed Ali <ahmed....@gmail.com>:

Ahmed Ali

unread,
Feb 2, 2010, 12:50:52 PM2/2/10
to Kuba Odias, log...@googlegroups.com
Hi Kuba and all,

The bug below has been fixed and included in latest code in github repo. Enjoy!

Ahmed

Reply all
Reply to author
Forward
0 new messages