Hello Giulio et alii,
For a series of headless installation with Bela's running SuperCollider code outside in the field I need to create text file logs of the SuperCollider post window for debugging purposes. In linux systems I would usually do something like
sclang > ~/postwindow_log.txt
or
sclang | tee ~/postwindow_log.txt
Since everything is working in general quite nicely I don't want to make too much changes to code. So I am looking for an elegant way to pipe the supercollider output to a text file, while using the 'Run project on boot' inside the Bela IDE, but I am struggling to find it. Could I use the 'User command line arguments' inside the Bela IDE for this in some way?
Thanks in advance!

In order to have these commands logged to file when a project is running from the IDE, place the following in the "Make parameters" text box in the project settings:

RUN_COMMAND=sclang $(SUPERCOLLIDER_FILE) | tee -a /tmp/sc

This won't apply when running the project on boot, unfortunately. The easiest way to make it work when the project runs on boot - and also from within the IDE - is to create file /root/Bela/CustomMakefileTop.in containing the following line:

RUN_COMMAND:=sclang $(SUPERCOLLIDER_FILE) | tee -a /tmp/sc

This - however - will prevent any non-Supercollider project from running correctly and you'd have to delete that file if you want to run a non-Supercollider project.

The above changes would survive updates of the core code on the board and the first one would allow to write to a different file for each project. A fix which will affect all Supercollider projects and no other projects, but which won't survive board updates requires you to edit /root/Bela/Makefile and replace the line

RUN_COMMAND?=bash -c 'touch /tmp/sclang.yaml; rm -rf $(SCLANG_FIFO) && mkfifo $(SCLANG_FIFO) && sclang -l /tmp/sclang.yaml $(SUPERCOLLIDER_FILE) <> $(SCLANG_FIFO)'

with something as simple as

RUN_COMMAND?=sclang $(SUPERCOLLIDER_FILE) | tee -a /tmp/sc
    21 days later