I am relatively new to NodeRED and tinker around with function nodes.
As I wasn't to sure about the flow context concept, I tried to add debug lines into my node's OnStartup, but they nowhere appeared in the debug window.
Although I use the selected node context, debug messages from the same nodes OnMessage tab appear as expected in the debug window.
Am I missing something, or is debugging in the OnStartup really not possible?
What sort of debug lines? If you mean you used console.log() then possibly they do not appear in the debug pane because they are run before node-red is fully started so the output gets lost. If you look in the node-red log you should see them.
node.log does not write to the debug sidebar at any time. It only writes to the console log.
You can use node.warn to write to the debug sidebar at any time.
There have been discussions in the past on giving the Function node a better logging API for the debug sidebar (rather than having to log everything as a warning). But not come to any final conclusion or contribution to make it so.