Stephen, are you using version 2 or version 3 of Model-Glue? I've been
browsing the framework source for both and the debug logging code is quite
different in the two versions.

Disclaimer: I have not actually tried any of the code snippets below.
Getting them to actually work is left as an exercise for the reader :-)


To get the raw data for the current debug log from a controller method
in Model-Glue 3:

logData = arguments.event.getTrace();

For Model-Glue 2:

logData = arguments.event.getEventRequest().getLog();

To get the rendered test for the current debug log from a controller method
in Model-Glue 3:

logOutput = getModelGlue().renderContextLog(arguments.event);

For Model-Glue 2:

logRenderer = createObject("component",
"ModelGlue.unity.debug.RequestLogRenderer").init();
logOutput = logRenderer.render(arguments.event.getEventRequest().getLog(),
getModelGlue().getConfigSetting("debug"));


For both versions of Model-Glue, the debug log rendering occurs after all
other request processing is complete, which means you cannot capture the
complete debug output in either a view or a controller. If you must have the
debug data for the entire request, your best bet in Model-Glue 3 is to
provide a replacement logRenderer as Sean Coyne mentioned. If you're stuck
in Model-Glue 2, your only choice is to hack the core framework code.

If you choose to create a replacement logRenderer to write to a file, I
suggest you use a design pattern such as Decorator or Observer to maintain
the original log rendering functionality.

Code that customizes built-in framework behaviors (such as log renderers)
tend to be sensitive to changes in the framework. If possible, you should
consider sharing any such code you write with the community so as to
distribute the maintenance costs.


Cheers,

Dennis

On Fri, Oct 30, 2009 at 11:17 AM, Stephen Moretti <[email protected]
> wrote:

>
>
> 2009/10/30 Sean Coyne <[email protected]>
>
>
>> A while back I added an ER to add the ability to override the
>> LogRenderer in ColdSpring so you can use your own.  Dan made the
>> change so it is usable now.
>>
>> http://docs.model-glue.com/ticket/338
>>
>> I'm not sure if you are referring to the CF debug info or the MG debug
>> info, but thought I would mention it
>>
>
> Sorry Sean. Yes I was looking for the ModelGlue debug output as opposed to
> the ColdFusion debug.
>
> Jared, Yup that's perhaps a step on from what I was thinking about. I was
> just thinking something like :
>
> somevar = ModelGlue.renderDebug();
>
> and then I could push "somevar" out to a file of my choice or I could just
> output the renderDebug() in a view.
>
> Thinking about it I suspect that the logfile="path/to/logfile" would be a
> bit restrictive in my particular instance and could result in a massive log
> file, but also sounds good to me for other uses. Might need a few additional
> attributes, like turn on/off execution times.
>
> Stephen
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to