[erlang-questions] how can I make mnesia/sasl keep quiet

Ulf Wiger ulf.wiger@REDACTED
Thu Sep 1 19:05:47 CEST 2011


For those who want to change application environment variables in running systems, I recommend taking a look at gproc's support for environment variables.

Basically, gproc helps with a few different problems with configuration environments:

- there are so many ways to specify parameters: unix env vars, OTP env vars, mnesia, … Gproc handles a number of them and caches the read value as a gproc property.
- Updating the value is correspondingly supported.
- If you want to notify all others who have read (cached) the same variable, just use gproc's pub/sub pattern. The other processes will have to take care of updating their own cached value*.
- when debugging a process, its 'gproc_env' properties show which values it relies on. If a process failed to refresh its value, this will be apparent using a simple query against gproc.

https://github.com/esl/gproc/blob/master/test/gproc_tests.erl#L395 for some illustration (unit test cases)

BR,
Ulf W

* gproc:set_env(Scope, App, Key, Value, []) will accomplish this.

On 1 Sep 2011, at 17:04, Niclas Eklund wrote:

> 
> Hi!
> 
> Usually you should avoid application:set_env/3 if it's not your own application.
> 
> From the reference manual:
> 
> "Warning:
>       Use this function only if you know what you are doing, that is, on your own applications. It is very application and configuration parameter dependent when and how often the value is read by the application, and careless use of this function may put the application in a weird, inconsistent, and malfunctioning state."
> 
> Perhaps it works now, depending how SASL handles the parameter, but that might change at any given time without a warning.
> 
> Best regards,
> 
> Niclas @ Erlang/OTP
> 
> On Thu, 1 Sep 2011, Frédéric Trottier-Hébert wrote:
> 
>> You need to do application:set_env(sasl, errlog_type, Type). The function with only 2 arguments will do it to the application where the current process belongs -- it won't work if you're not running as a part of the SASL process group. Force it with 3 arguments, where the first one is the name of the application.
>> 
>> --
>> Fred Hébert
>> http://www.erlang-solutions.com
>> 
>> 
>> 
>> On 2011-09-01, at 08:59 AM, Dmitry Demeshchuk wrote:
>> 
>>> Perhaps application:set_env(errlog_type, error) ?
>>> 
>>> On Thu, Sep 1, 2011 at 4:57 PM, Joe Armstrong <erlang@REDACTED> wrote:
>>>> On Thu, Sep 1, 2011 at 1:30 AM, Joseph Norton <norton@REDACTED> wrote:
>>>>> 
>>>>> Try the following ....
>>>>> 
>>>>> $ erl -sasl errlog_type error
>>>>> 
>>>> 
>>>> Thanks
>>>> 
>>>> Any idea if this also be done if I start with
>>>> 
>>>> $erl
>>>> 
>>>> I prefer to do *everything* by calling functions and not with command
>>>> line arguments
>>>> 
>>>> /Joe
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> Joseph Norton
>>>>> norton@REDACTED
>>>>> 
>>>>> 
>>>>> 
>>>>> On Sep 1, 2011, at 3:27 AM, Dmitry Demeshchuk wrote:
>>>>> 
>>>>>> That's exactly what I want to do with rabbitmq erlang client as well :(
>>>>>> 
>>>>>> On Wed, Aug 31, 2011 at 9:07 PM, Joe Armstrong <erlang@REDACTED> wrote:
>>>>>>> When I do
>>>>>>> 
>>>>>>>> mnesia:stop().
>>>>>>> 
>>>>>>> I see this
>>>>>>> 
>>>>>>> =INFO REPORT==== 31-Aug-2011::19:03:57 ===
>>>>>>>   application: mnesia
>>>>>>>   exited: stopped
>>>>>>>   type: temporary
>>>>>>> 
>>>>>>> How can I get rid of this printout? I never want to see excess output
>>>>>>> if the system has correctly done what I told it to do.
>>>>>>> 
>>>>>>> /Joe
>>>>>>> _______________________________________________
>>>>>>> erlang-questions mailing list
>>>>>>> erlang-questions@REDACTED
>>>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Best regards,
>>>>>> Dmitry Demeshchuk
>>>>>> _______________________________________________
>>>>>> erlang-questions mailing list
>>>>>> erlang-questions@REDACTED
>>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Best regards,
>>> Dmitry Demeshchuk
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110901/f9087242/attachment.htm>


More information about the erlang-questions mailing list