bryan_basho
bryan_basho

Reputation: 159

Attempting to open an Erlang 'disk_log' in 'wrap' mode triggers an error : {error,'no_such_log'}

If I try to open a disk_log in 'halt' mode, it is created correctly.

31> disk_log:open([  {file, "/tmp/ddddd"}, {type, halt}, 
    {size, 1000}, {name,dave}, {linkto,self()}, 
    {mode,read_write} ] ).
{ok,dave}

However, if I attempt to perform the same operation in 'wrap' mode, the module fails with an error.

33> disk_log:open([  {file, "/tmp/ddddd2"}, {type, wrap}, 
    {size, 1000}, {name,dave2}, {linkto,self()}, 
    {mode,read_write} ] ).
{error,no_such_log}

I can't see an obvious reason why this might be the case, any suggestions?

Upvotes: 1

Views: 215

Answers (1)

bryan_basho
bryan_basho

Reputation: 159

The size argument determines both the file size, and the maximum number of open files when in 'wrap' mode. Specifying size as a tuple, in this case '{1000,5}' fixes the problem.

 34> disk_log:open([  {file, "/tmp/ddddd2"}, {type, wrap}, 
     {size, {1000,5}}, 
     {name,dave2}, {linkto,self()}, {mode,read_write} ] ).
 {ok,dave2}

Upvotes: 1

Related Questions