[erlang-questions] any way to avoid *.config file for sasl?

50 views
Skip to first unread message

Motiejus Jakštys

unread,
Nov 1, 2012, 7:27:46 AM11/1/12
to erlang-q...@erlang.org, ignas.vy...@spilgames.com, Enrique Paz Pérez
Hi,

a session is worth a thousand words:

motiejus@precise> erl
Erlang R15B02 (erts-5.9.2) [source] [smp:2:2] [async-threads:0]
[kernel-poll:false]

Eshell V5.9.2 (abort with ^G)

1> application:set_env(sasl, sasl_error_logger, false).
ok
2> application:start(sasl).
ok
3>
=PROGRESS REPORT==== 1-Nov-2012::10:51:32 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.41.0>},
{name,alarm_handler},
{mfargs,{alarm_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
...
3> application:get_env(sasl, sasl_error_logger).
{ok,tty}
4>

Conclusion is: if the value (in this case sasl_error_logger) is defined
in sasl.app, on application startup the value set by
application:set_env/3 is overwritten by the value from the .app file.
That means that if I want to change the value of sasl_error_logger, I
*must* use -config FILE when starting Erlang.

Is there any other way to change that value in a running system, before
starting sasl?

Best regards,
Motiejus
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Slava Yurin

unread,
Nov 1, 2012, 7:30:07 AM11/1/12
to Motiejus Jakštys, erlang-q...@erlang.org, ignas.vy...@spilgames.com, Enrique Paz Pérez
v.yurin@hell:~$ erl -sasl sasl_error_logger false 
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.4  (abort with ^G)
1> application:start(sasl).
ok
2> application:get_env(sasl, sasl_error_logger).
{ok,false}
3> 
 
01.11.2012, 18:28, "Motiejus Jakštys" <desir...@gmail.com>:

Martin Bjorklund

unread,
Nov 1, 2012, 7:35:53 AM11/1/12
to desir...@gmail.com, ignas.vy...@spilgames.com, erlang-q...@erlang.org, Enrique....@spilgames.com
Hi,

Motiejus Jakštys <desir...@gmail.com> wrote:
> a session is worth a thousand words:

[...]

> Is there any other way to change that value in a running system, before
> starting sasl?

1> application:load(sasl).
ok
2> application:set_env(sasl, sasl_error_logger, false).
ok
3> application:start(sasl).
ok
4> application:get_env(sasl, sasl_error_logger).
{ok,false}


/martin

Magnus Henoch

unread,
Nov 1, 2012, 7:36:05 AM11/1/12
to Motiejus Jakštys, erlang-q...@erlang.org
Motiejus Jakštys <desir...@gmail.com> writes:

> Is there any other way to change that value in a running system, before
> starting sasl?

You can load sasl before setting the variable:

Erlang R15B (erts-5.9) [source] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9 (abort with ^G)
1> application:load(sasl).
ok
2> application:set_env(sasl, sasl_error_logger, false).
ok


3> application:start(sasl).
ok
4> application:get_env(sasl, sasl_error_logger).
{ok,false}


Regards,
Magnus

Jachym Holecek

unread,
Nov 1, 2012, 7:34:15 AM11/1/12
to Motiejus Jak?tys, erlang-q...@erlang.org
# Motiejus Jak?tys 2012-11-01:
> That means that if I want to change the value of sasl_error_logger, I
> *must* use -config FILE when starting Erlang.

You can also set env from command line:

# erl -sasl sasl_error_logger false
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]

Eshell V5.8.5 (abort with ^G)
1> application:start(sasl).
ok
2> application:get_env(sasl, sasl_error_logger).
{ok,false}
3>

BR,
-- Jachym

Motiejus Jakštys

unread,
Nov 1, 2012, 8:19:01 AM11/1/12
to Martin Bjorklund, ignas.vy...@spilgames.com, erlang-q...@erlang.org, Enrique....@spilgames.com
On Thu, Nov 1, 2012 at 11:35 AM, Martin Bjorklund <m...@tail-f.com> wrote:
>
> 1> application:load(sasl).
> ok
> 2> application:set_env(sasl, sasl_error_logger, false).
> ok
> 3> application:start(sasl).
> ok
> 4> application:get_env(sasl, sasl_error_logger).
> {ok,false}
>

Hi,
thanks everyone! This is exactly what I wanted.

--
Motiejus Jakštys

Reply all
Reply to author
Forward
0 new messages