Update template.py

Add logging