erlang-syslog
erlang-syslog copied to clipboard
syslog module doesn't recover after an error
Hi.
If i send a one bad message(in my case unicode string instead of utf8 string), then all messages after that get me a "bad argument" error despite the fact that they are correct:
15> {ok, Logh} = syslog:open("test", [pid], local1).
{ok,#Port<0.1838>}
16> syslog:log(Logh, info, "ascii message").
ok
17> syslog:log(Logh, info, <<"ascii message">>).
ok
18> syslog:log(Logh, info, unicode:characters_to_binary("utf8 сообщение")).
ok
19> syslog:log(Logh, info, "utf8 сообщение").
=ERROR REPORT==== 17-Nov-2015::11:25:21 ===
Bad value on output port 'syslog_drv'
** exception error: bad argument
in function port_command/2
called as port_command(#Port<0.1838>,
[<<0,0,0,6>>,
[117,116,102,56,32,1089,1086,1086,1073,1097,1077,1085,1080,
1077],
<<0>>])
in call from syslog:log/3 (src/syslog.erl, line 127)
20> syslog:log(Logh, info, unicode:characters_to_binary("utf8 сообщение")).
** exception error: bad argument
in function port_command/2
called as port_command(#Port<0.1838>,
[<<0,0,0,6>>,
<<117,116,102,56,32,209,129,208,190,208,190,208,177,209,
137,208,181,208,189,208,184,208,181>>,
<<0>>])
in call from syslog:log/3 (src/syslog.erl, line 127)
21> syslog:log(Logh, info, <<"ascii message">>).
** exception error: bad argument
in function port_command/2
called as port_command(#Port<0.1838>,[<<0,0,0,6>>,<<"ascii message">>,<<0>>])
in call from syslog:log/3 (src/syslog.erl, line 127)
22> syslog:log(Logh, info, "ascii message").
** exception error: bad argument
in function port_command/2
called as port_command(#Port<0.1838>,[<<0,0,0,6>>,"ascii message",<<0>>])
in call from syslog:log/3 (src/syslog.erl, line 127)
Can syslog module automatically recover in this situation? It would be great if syslog module keeps a working state despite a one bad message.
Thanks!