You can only initiate query logging in Teradata session mode if you make the request outside the boundaries of an explicit (BT/ET) transaction.
You cannot perform BEGIN QUERY LOGGING in Teradata session mode within an explicit transaction.
You cannot perform BEGIN QUERY LOGGING in ANSI session mode.