Manual port of stud logging branch
Merge branch 'mjr-merge-logging'

Conflicts:
	stud.cc