Logging the actual template causing missing terminating [#] error


#1

We have an old, old, old codebase with about three gazillion templates. Now, the issue I have is that there’s a template somwehere in the codebase that is simply not working and it throws “missing terminating [#]” error to the logs.

Problem here is that the (application.log) logs don’t show what .cfm template this is.

Thus, the suggestion to add that info to the logs to be able to actually find the problem in question.


#2

got a stacktrace?


#3

Put a try/catch around the code and dump the error. That might help narrow things down.

Either in tag:

<cftry>

    <!--- put your problem code here --->
    
    <cfcatch>
        <cfdump var="#cfCatch#>
    </cfcatch>

</cftry>

Or in cfscript:

try {

    // put your problem code here

 } catch (any e) {
    dump(e);
}

#4

Problem is that I don’t know what template this is. We have literally tens of thousands of .cfm templates and one (or some) of them is causing this error, but logs don’t indicate which template it is.


#5

You should still be able to put a try/catch around the base template that is being called. For example, if your error is happening in http://yoursite.com/sometemplate.cfm, then add the try catch around all the code on that page.


#6

Ah, that’s the problem: The logs don’t show which template or even URI it is that is causing the error. Thus, with the codebase of thousands of templates, we cannot simply put cfcatch to all templates to see what is causing it. But would simply like to see in the logs, which template it is - debugging and finding the culprit would be easy if we’d get that info.