Hey Neal,

So this wound up a little more complicated than I expected.  As usual.

I was thinking you wanted to enable headless logging to get info on global 
variable changes and turtle/link births and deaths, correct?  I don't see much 
point in trying to get UI events like widgets added, command center code 
entered, as they will not occur headlessly.  I was then looking to run a test 
to make sure I gave you good advice when I found something strange.  It appears 
logging of turtle births and deaths and global variable changes hasn't worked 
since at least version 5.0 of NetLogo.  The code to perform the logging was 
removed in that release and never re-added.  I don't think logging of links was 
ever added properly, but either way it also does not work now.  I'm going to 
make a note to have our team look into getting this fixed.  It must not be a 
much-used feature since we have no other reports on it.

But with that being that case I can't see a lot of benefit to enabling logging 
in your headless application of NetLogo, as no worthwhile information will be 
presented.  If you want to try anyway, here is the code the GUI app uses to 
setup logging:  
https://github.com/NetLogo/NetLogo/blob/hexy/netlogo-gui/src/main/app/App.scala#L518-L521
  
But again, the `HeadlessWorkspace` doesn't even take in a listener as the 
`GUIWorkspace` does, so it won't use that to log anything at all.  Only things 
that log themselves globally would get recorded, and I don't see any of those 
that aren't UI elements.

To switch gears then, I'd recommend using BehaviorSpace to get information out 
of a headless model run.  If you need to control what data is extracted 
regardless of the model (you don't want to hand-edit multiple models to work in 
your new program), you can do so either by generating the XML file to use, or 
by creating a `LabProtocol` and running BehaviorSpace through code.  See 
[the answer on this StackOverflow question] 
<https://stackoverflow.com/questions/58317724/netlogo-api-controller-get-table-view>
 for more details on that.

If BehaviorSpace doesn't sound like it'll fit your use case, please elaborate a 
little more and maybe we can come up with something else.

-Jeremy

On Wednesday, October 6, 2021 at 11:50:32 AM UTC-5 
jeremy...@northwestern.edu wrote:

> Enabling logging through the preferences menu in the GUI should also 
> enable it when running headlessly through the included script and when 
> running through sbt as it's stored per-user.  Since this is the devel group 
> I'm not 100% which headless method you are referring to, though.  If you 
> can provide more details on what you are doing and why, I or someone else 
> might be able to provide more helpful information.  Thanks.
>
> -Jeremy
>
> On Wednesday, October 6, 2021 at 10:20:44 AM UTC-5 neal.f...@gmail.com 
> wrote:
>
>> Hi,
>>
>> How can I enable logging for running netlogo headless? Thanks.
>>
>> Neal
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netlogo-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netlogo-devel/4504fc50-13e6-4c07-962f-be255ffea94dn%40googlegroups.com.

Reply via email to