[{"data":1,"prerenderedAt":454},["ShallowReactive",2],{"/logging":3,"/logging-surround":443},{"id":4,"title":5,"body":6,"description":412,"extension":413,"meta":414,"navigation":432,"path":440,"seo":441,"stem":12,"__hash__":442},"content/logging.md","Logging",{"type":7,"value":8,"toc":396},"minimark",[9,21,25,28,38,69,77,80,108,111,121,130,140,152,173,183,190,193,202,210,263,266,280,289,300,309,318,321,329,332,335,344,362,371],[10,11,15],"h1",{"id":12,"className":13},"logging",[14],"section-heading",[16,17,5],"a",{"className":18,"href":20},[19],"section-anchor","#logging",[22,23,24],"p",{},"NetLogo’s logging facility allows researchers to record student actions for\nlater analysis.",[22,26,27],{},"Logging in NetLogo is invisible to the student once initiated. The researcher\ncan choose the type of events logged through the NetLogo preferences or by using\na custom command line switch to start NetLogo.",[22,29,30,31,37],{},"In NetLogo version 6.2.2 and earlier, log4j was the library used and the logging\noutput was in XML format. See\n",[16,32,36],{"href":33,"rel":34},"https://ccl.northwestern.edu/netlogo/6.2.2/docs/",[35],"nofollow","the documentation for that prior version","\nif you’re not on the latest NetLogo release.",[39,40,43,53],"div",{"className":41},[42],"toc",[44,45,48],"h4",{"id":46,"className":47},"table-of-contents",[14],[16,49,52],{"className":50,"href":51},[19],"#table-of-contents","Table of Contents",[54,55,56,63],"ul",{},[57,58,59],"li",{},[16,60,62],{"href":61},"#starting-logging","Starting Logging",[57,64,65],{},[16,66,68],{"href":67},"#using-logging","Using Logging",[70,71,74],"h2",{"id":72,"className":73},"starting-logging",[14],[16,75,62],{"className":76,"href":61},[19],[22,78,79],{},"There is a NetLogo preference to enable logging:",[54,81,82,94,105],{},[57,83,84,85,89,90,93],{},"Open NetLogo, then open ",[86,87,88],"strong",{},"Preferences"," from the ",[86,91,92],{},"Tools"," menu.",[57,95,96,97,100,101,104],{},"Check the box for ",[86,98,99],{},"Enable Logging:"," then click ",[86,102,103],{},"OK",".",[57,106,107],{},"Restart NetLogo and logging will be enabled.",[22,109,110],{},"The setting will remain in effect until it is unchecked and NetLogo is restarted\nagain.",[22,112,113,114,117,118,120],{},"You can also specify the ",[86,115,116],{},"Directory to store logs:"," in the NetLogo\n",[86,119,88],{},". If you leave this value blank with logging enabled the default\nlocation of the user’s home directory will be used. See below for more\ninformation on the default location.",[22,122,113,123,126,127,129],{},[86,124,125],{},"Events to log:"," in the NetLogo ",[86,128,88],{},". This\nis a comma-separate list of the event names or “shortcut” names. If you leave\nthis value blank with logging enabled a set of default events will be logged.\nSee below for more information on the event names and what the defaults are.",[131,132,135],"h3",{"id":133,"className":134},"command-line-switches",[14],[16,136,139],{"className":137,"href":138},[19],"#command-line-switches","Command Line Switches",[22,141,142,143,147,148,151],{},"You can also enable logging and set the log directory and log events with\ncommand line switches. If you specify either the ",[144,145,146],"code",{},"--log-directory"," or\n",[144,149,150],{},"--log-events"," switch, then logging will be enabled and the switch values will\noverride any preferences set in the NetLogo UI.",[22,153,154,155,169,170,172],{},"Let’s assume you are running on Linux and you have NetLogo installed in a\n",[144,156,157,164,165],{},[158,159,163],"span",{"className":160},[161,162],"token","variable","NetLogo"," ",[158,166,168],{"className":167},[161,162],"6.2.3"," directory in your home folder. To enable logging, invoke the\n",[144,171,163],{}," executable like so:",[174,175,181],"pre",{"className":176,"code":178,"language":179,"meta":180},[177],"language-sh","~/NetLogo\\ 6.2.3/NetLogo --log-directory ~/NetLogoLogs/ --log-events \"default, ticks, globals\"\n","sh","",[144,182,178],{"__ignoreMap":180},[70,184,187],{"id":185,"className":186},"using-logging",[14],[16,188,68],{"className":189,"href":67},[19],[22,191,192],{},"When NetLogo starts up it will ask for a user name. This name will appear in all\nthe logs generated during this session.",[131,194,197],{"id":195,"className":196},"events",[14],[16,198,201],{"className":199,"href":200},[19],"#events","Events",[22,203,204,205,209],{},"Below are all of the events that can be logged with the logging app. By default\nall of these events are logged ",[206,207,208],"em",{},"except"," “global”, “link”, “tick”, and “turtle”\nsince they can cause a large number of log entries to be created.",[54,211,212,215,218,221,224,227,230,233,236,239,242,245,248,251,254,257,260],{},[57,213,214],{},"button - button widget presses",[57,216,217],{},"chooser - chooser widget changes",[57,219,220],{},"comment - any user comments, currently only generated for compiler errors",[57,222,223],{},"compile - when the model code is recompiled",[57,225,226],{},"command-center - when code is run through the command center",[57,228,229],{},"global - when a global variable value changes",[57,231,232],{},"input-box - when an input box widget changes",[57,234,235],{},"link - when a link agent is created or dies",[57,237,238],{},"model-open - when a model is opened",[57,240,241],{},"slider - when a slider widget changes",[57,243,244],{},"speed-slider - when the speed slider changes",[57,246,247],{},"start - always the first entry of a log, contains system info",[57,249,250],{},"switch - when a switch widget changes",[57,252,253],{},"stop - always the last entry of a log",[57,255,256],{},"turtle - when a turtle agent is created or dies",[57,258,259],{},"widget-edit - when a widget is added to or removed from the model",[57,261,262],{},"tick - when the tick counter is advanced",[22,264,265],{},"There are also some shortcut names you can use in the preferences to refer to\ncollections of events:",[54,267,268,271,274,277],{},[57,269,270],{},"all - button, chooser, comment, compile, command-center, global, input-box,\nlink, model-open, slider, speed-slider, start, switch, stop, turtle,\nwidget-edit, tick",[57,272,273],{},"agents - link, turtle",[57,275,276],{},"defaults - everything but global, link, tick, and turtle",[57,278,279],{},"greens - chooser, input-box, slider, switch - the “global variable” widgets",[22,281,282,283,285,286,288],{},"Example logging strings you could put in the ",[86,284,125],{}," setting in\npreferences dialog or use via the ",[144,287,150],{}," command line switch.",[54,290,291,294,297],{},[57,292,293],{},"“button, model-open, widget-edit” - log only button widget presses, model open\nevents, and widget add/remove",[57,295,296],{},"“defaults, global” - add global variable change events to the defaults list",[57,298,299],{},"“button, greens, model-open” - log widget use and model open events.",[131,301,304],{"id":302,"className":303},"json-output",[14],[16,305,308],{"className":306,"href":307},[19],"#json-output","JSON Output",[22,310,311,312,317],{},"The output is in ",[16,313,316],{"href":314,"rel":315},"https://en.wikipedia.org/wiki/JSON",[35],"JSON text format",". Below\nis an example log file with some small modifications to content to fit better in\nthis document.",[22,319,320],{},"Each line has an “event” identifying its type along with a “timeStamp” of when\nit occurred. Then there is an “eventInfo” entry that contains further\ninformation specific to the event. For example, “model-open” event contains the\nmodel “name”, and the “button” events contain the “buttonName” and whether the\nclick stopped a forever button, “wasStopped”.",[174,322,327],{"className":323,"code":325,"language":326,"meta":180},[324],"language-json","[\n  {\"event\":\"start\",\"timeStamp\":\"2022-06-17 11:29:56.737\",\"eventInfo\":{\"studentName\":\"Larry\",\"modelName\":\"Slime.nlogo\",\"version\":\"NetLogo 6.#.#\",\"ipAddress\":\"192.168.1.11\",\"loginName\":\"cpu_user\",\"events\":[\"input-box\",\"switch\",...,\"widget-edit\"]}}\n, {\"event\":\"model-open\",\"timeStamp\":\"2022-06-17 11:29:56.738\",\"eventInfo\":{\"name\":\"Slime.nlogo\"}}\n, {\"event\":\"compile\",\"timeStamp\":\"2022-06-17 11:29:57.201\",\"eventInfo\":{\"code\":\"patches-own [chemical]\\n...\",\"success\":true}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:29:58.617\",\"eventInfo\":{\"buttonName\":\"setup\",\"wasStopped\":false}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:29:58.675\",\"eventInfo\":{\"ticks\":0.0}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:29:58.676\",\"eventInfo\":{\"buttonName\":\"setup\",\"wasStopped\":true}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:29:58.961\",\"eventInfo\":{\"buttonName\":\"go\",\"wasStopped\":false}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:29:58.993\",\"eventInfo\":{\"ticks\":1.0}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:29:59.030\",\"eventInfo\":{\"ticks\":2.0}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:29:59.076\",\"eventInfo\":{\"ticks\":3.0}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:29:59.123\",\"eventInfo\":{\"ticks\":4.0}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:29:59.921\",\"eventInfo\":{\"buttonName\":\"go\",\"wasStopped\":true}}\n, {\"event\":\"slider\",\"timeStamp\":\"2022-06-17 11:30:01.681\",\"eventInfo\":{\"valueChanged\":true,\"min\":1.0,\"globalName\":\"population\",\"max\":1500.0,\"inc\":1.0,\"buttonReleased\":false,\"newValue\":399.0}}\n, {\"event\":\"slider\",\"timeStamp\":\"2022-06-17 11:30:01.698\",\"eventInfo\":{\"valueChanged\":true,\"min\":1.0,\"globalName\":\"population\",\"max\":1500.0,\"inc\":1.0,\"buttonReleased\":false,\"newValue\":391.0}}\n, {\"event\":\"slider\",\"timeStamp\":\"2022-06-17 11:30:02.317\",\"eventInfo\":{\"valueChanged\":true,\"min\":1.0,\"globalName\":\"population\",\"max\":1500.0,\"inc\":1.0,\"buttonReleased\":false,\"newValue\":179.0}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:30:02.910\",\"eventInfo\":{\"buttonName\":\"setup\",\"wasStopped\":false}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:30:02.919\",\"eventInfo\":{\"ticks\":-1.0}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:30:02.922\",\"eventInfo\":{\"ticks\":0.0}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:30:02.922\",\"eventInfo\":{\"buttonName\":\"setup\",\"wasStopped\":true}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:30:03.254\",\"eventInfo\":{\"buttonName\":\"go\",\"wasStopped\":false}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:30:03.258\",\"eventInfo\":{\"ticks\":1.0}}\n, {\"event\":\"tick\",\"timeStamp\":\"2022-06-17 11:30:03.293\",\"eventInfo\":{\"ticks\":2.0}}\n, {\"event\":\"button\",\"timeStamp\":\"2022-06-17 11:30:03.763\",\"eventInfo\":{\"buttonName\":\"go\",\"wasStopped\":true}}\n, {\"event\":\"command-center\",\"timeStamp\":\"2022-06-17 11:30:08.489\",\"eventInfo\":{\"owner\":\"Command Center\",\"code\":\"ask turtles [ set color black ]\",\"agentType\":\"O\",\"success\":true}}\n, {\"event\":\"stop\",\"timeStamp\":\"2022-06-17 11:30:09.703\"}\n]\n","json",[144,328,325],{"__ignoreMap":180},[22,330,331],{},"JSON is a very common data format so there are numerous ways to use it. Most\nscripting and programming languages have easy ways to read JSON data in so that\nit can be processed, fed to another system (such as a database), or re-formatted\nsomehow (perhaps to a plot using a plotting library).",[22,333,334],{},"Modern versions of Microsoft Excel can import JSON directly. Google Sheets does\nnot yet support JSON import natively, but there are add-on scripts that can be\nused. There are also numerous online converters that can turn JSON to a\n“flattened” CSV or just convert it to XML as well.",[131,336,339],{"id":337,"className":338},"where-logs-are-stored",[14],[16,340,343],{"className":341,"href":342},[19],"#where-logs-are-stored","Where Logs are Stored",[22,345,346,347,350,351,354,355,358,359,104],{},"By default logs are stored in the operating system specific user’s home\ndirectory. On most Unix-like systems that is ",[144,348,349],{},"/home/\u003Cusername>/",". On Windows the\nlogs can be found in ",[144,352,353],{},"C:\\Users\\\u003Cusername>\\",", where ",[144,356,357],{},"\u003Cusername>"," is the logged in\nuser. On macOS the usual location is ",[144,360,361],{},"/Users/\u003Cusername>/",[131,363,366],{"id":364,"className":365},"managing-log-files",[14],[16,367,370],{"className":368,"href":369},[19],"#managing-log-files","Managing Log Files",[22,372,373,374,384,385,387,388,391,392,395],{},"There are two convenience commands that will help you manage the logs.\n",[144,375,376,164,380],{},[158,377,379],{"className":378},[161,162],"__zip-log-files",[158,381,383],{"className":382},[161,162],"*filename*"," will gather all the logs in the temp directory and\nput them in one zip file, at the location specified. After doing\n",[144,386,379],{}," the existing logs are ",[86,389,390],{},"not"," deleted, you can do so\nexplicitly by using ",[144,393,394],{},"__delete-log-files",". Both commands stop the current log\nfile (so it can be zipped or deleted) and a new one is started afterwards.",{"title":180,"searchDepth":397,"depth":398,"links":399},5,3,[400,402,406],{"id":46,"depth":401,"text":52},4,{"id":72,"depth":403,"text":62,"children":404},2,[405],{"id":133,"depth":398,"text":139},{"id":185,"depth":403,"text":68,"children":407},[408,409,410,411],{"id":195,"depth":398,"text":201},{"id":302,"depth":398,"text":308},{"id":337,"depth":398,"text":343},{"id":364,"depth":398,"text":370},"Guide to logging and data collection features in NetLogo for recording simulation data and model outputs.","md",{"source":415,"metadataOutputPath":416,"projectConfig":417,"language":424,"inheritFrom":433,"output":432,"version":418,"keywords":434,"tags":437,"icon":438,"assetsRoot":439},"autogen/logging.md","content/logging.metadata.yaml",{"version":418,"projectRoot":104,"scanRoot":419,"outputRoot":420,"defaults":421,"engine":427,"partials":428,"dedupeIdenticalDiskWrites":432},"7.0.4","autogen","content",{"inheritFrom":422,"language":424,"output":425,"extension":413,"title":426,"version":418},[423],0,"en",false,"NetLogo User Manual","handlebars",{"directoryPaths":429,"extensions":430},[104],[431,413],"mustache",true,[423],[5,435,436,163],"Data Collection","Output",[5,435,436],"i-lucide-database-backup","/home/runner/work/Helio/Helio/apps/docs/autogen","/logging",{"title":5,"description":412},"guRh9XjmQhtbUs2d1-9USiTawTyNYpCF2g4qtPd3XkQ",[444,449],{"title":445,"path":446,"stem":447,"description":448},"NetLogoLab","/lab","lab","NetLogoLab is a collection of extensions that allows you to control physical devices with NetLogo.",{"title":450,"path":451,"stem":452,"description":453},"LevelSpace Extension","/ls","ls","Documentation for the LevelSpace extension.",1777657789332]