erlang lager_syslog驱动程序失败

时间:2016-08-01 15:10:04

标签: erlang rebar

我试图在我的项目中使用lager_syslog,但似乎缺少驱动程序。

这是我的rebar.conf

    {deps, [
       ...
       {lager_syslog, {git, "https://github.com/basho/lager_syslog.git", {branch, master}}}
    ]}.

我的测试处理程序:

    {lager_syslog_backend, ["test", local1, info]},

错误:

19:29:09.981 [error] Lager failed to install handler {lager_syslog_backend,{"test",local1}} into lager_event, retrying later : {error,
   {{shutdown,
     {failed_to_start_child,
      syslog,
      "could not load driver syslog_drv: \"cannot open shared object file: No such file or directory\""}},
    {syslog_app,
     start,
     [normal,
      []]}}}

有什么建议吗?

1 个答案:

答案 0 :(得分:3)

感谢 Kenneth Lakin ,他在邮件列表中回答了我的问题

IIRC,rebar3将端口编译器移到了一个rebar3插件,而不是 将其与核心项目捆绑在一起。从我所见,rebar2 依赖它的项目将无法加载其端口驱动程序。

添加

{overrides,
  [{override, syslog, [
    {plugins, [pc]},
    {artifacts, ["priv/syslog_drv.so"]},
    {provider_hooks, [
      {post,
        [
        {compile, {pc, compile}},
        {clean, {pc, clean}}
        ]
      }]
    }
  ]}
]}.

到项目中的rebar.conf,清理并重建。 (syslog项目 是lager_syslog的端口驱动程序所在的位置。)

另请参阅:https://github.com/blt/port_compiler#use-with-existing-dependency