Debug as you would any script. Run iwpt_compile from the shell. Look for errors, put debug (print) statements in the TPL. There is no magic trick.
However, IMHO, it is overkill and will not help in many cases. If you have syntax errors or XML errors then it will never get called.
All these years I have not seen a single instance of log4perl in action. log4j (Java) is very common but for perl I've never seen it.
I use it all the time on my projects where I do actual development (as opposed to just upgrading)
I had a feeling that if anybody you'd have experience with this :-). Is it pretty similar to how log4j works? I would assume so.