LogBox in a Model component

i know there's the separation of data and stuff, but is it possible to
use the logbox in a model component? neither logbox nor the log
objects seem to be in the variable scope of my model components.
injecting logbox doesn't seem to work either.

i'm using ColdBox 3.0 RC1 on Windows with ColdFusion 9.0.1

You would need to inject it into your model

<cfproperty name="logbox" inject="logbox" >

Then be sure that the autowiring interceptor is configured and that you are getting your model objects with getModel() or injecting them into your handler.

Hope that helps,
Curt

You would need to inject it into your model
<cfproperty name="logbox" inject="logbox" >

if i do that i get a "invalid column name"

Then be sure that the autowiring interceptor is configured and that you are getting your model > objects with getModel() or injecting them into your handler.

i'm using the entityService:<Model> for that.

i just set the property as being non persistent. so that's what i have
now

property name="logbox" inject="logbox" persistent="false";

i still can't use it due to: "Variable LOGBOX is undefined." ... even
after fwreinit.

I had the same issue a while back as well when trying to inject logbox into a persistent model. I didn't find a way to get it to work.

Nolan Dubeau

Load *.*,8,1

There are a few extra steps required to setup autowiring on a persistent
ORM model.

Read this guide. It should explain it.

http://wiki.coldbox.org/wiki/Extras:ORMEventHandler.cfm

Let me know if there is something you don't understand.

Curt Gratz
Computer Know How

awesome!! thanks a bunch. that did the trick.

I’m still having troubles on this. I’ve done the following.

  1. Enabled an ORM event handler in my Application.cfc ORM settings. (model.ORMEventHandler)
  2. Enabled entityInjection in the autowire interceptor

//Autowire
{class=“coldbox.system.interceptors.Autowire”,properties={
entityInjection = true
}
}

  1. Injected logbox into my Group.cfc persistent model:

property name=“log” inject=“coldbox:plugin:logger”;

Now when I try to call a service which uses Group.cfc I get the following error

Error Messages: Error while loading the entity.
java.sql.SQLSyntaxErrorException: [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name ‘log’.

On a side note, each of my entities extend a BasePersistentObject.cfc which I had forgot also had logbox injected. That being said because my entities extend a cfc which has logbox inject should I not be able to use logbox in the child entity? (which isn’t working)

Thanks.

Nolan

you probably have to set this property as non persistent, like i did.

property name="log" inject="coldbox:plugin:logger" persistent="false";

property name=“log” inject=“coldbox:plugin:logger” **persistent="**false";

Add the persistent=”false” to your property.

Again, they will only work if you have event handling setup even if what they extend is not a persistent object.

Curt

Oop! Missed that one.

K, added the attribute, then created a postLoad() function in my Group.cfc entity like so:

public void function postLoad(){
  log.debug("this is the postLoad log output!");
}

and ORM settings are:

eventhandling = true,
eventhandler = "model.ORMEventHandler",

When re-run I receive the following error:

Error Messages: Error while loading the entity.
org.hibernate.HibernateException: coldfusion.runtime.UndefinedVariableException: Variable LOG is undefined.

Did I miss something?

{need more coffeee.....}

  • @hint The ORM event handler. If using the entity injector and you override a postLoad() handler, then you must

  • call the super.postLoad(arguments.entity) manually.

Curt

would an ORMReload() help in this case?

Doh! Sorry, missed that.

Where would super.postLoad(arguments.entity) be called? From within the entity which overrides the postLoad()?

Thanks.

Asked this on the Railo list as well - asking here as it’s relevant here as well :-

I have used the Vivio Windows installer to install Railo on IIS7 with Tomcat. All seems to work fine.

My application uses coldbox framework and I have used the web.config found here( http://blog.coldbox.org/post.cfm/coldbox-and-url-rewrites-with-iis-7)) to set up URL rewriting in IIS7

What is happening is this :-

A request goes to www.sitename.com/handler/action
gets rewritten to
www.sitename.com/index.cfm
and removes the /handler/action part.

Which results in every site URL being redirected to the main index.cfm

Any ideas on how do I solve this issue ?

Thanks a lot in advance.

Regards,
Anuj Gakhar.

I am not sure if this is a bug or not, but I have found that if you extend an Entity the properties in that parent Entity are not traversed down to the children. Which seems to be what you are experiencing.

Regards,

Andrew Scott

http://www.andyscott.id.au/

For the best Mod_Rewrite for IIS you might want to head over to Helicon and check there package out, it is the best since it also uses the same .htaccess file that Apache can use.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Could do that but the problem here does not seem to be with the rewriting. It appears the PATH_INFO variable is not being carried over to Tomcat so it only ever executes index.cfm

Anuj Gakhar