logging and page exception handling

And removed redundant template context variable.