You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Karthik N <ka...@gmail.com> on 2006/10/13 02:38:19 UTC

Tap 4.0.2: How to enable Logging to log enhanced class source code??

Hi,

In my tapestry app I'm trying to figure how to log the code of the Enhanced
class.  I dug through the sources and found that in the
EnhancementOperationImpl there is this statement:

        if (_log != null)
            _log.debug("Creating class:\n\n" + _classFab);


EnhancementOperationImpl in turn is called by
ComponentConstructorFactoryImpl

ComponentConstructorFactoryImpl has a
    public void setLog(Log log)


And an instance of ComponentConstructorFactoryImpl gets created in the
tapestry.enhance.xml

    <invoke-factory>
      <construct class="
org.apache.tapestry.services.impl.ComponentConstructorFactoryImpl ">
        <set-service property="classFactory" service-id="
hivemind.ClassFactory"/>
        <event-listener service-id="tapestry.ResetEventHub"/>
        <event-listener service-id=" tapestry.describe.ReportStatusHub"/>
        <set-service property="validator"
service-id="EnhancedClassValidator"/>
        <set-service property="chain" service-id="EnhancementWorkerChain"/>
      </construct>
    </invoke-factory>

My question is - can I do something about being able to pass a new Log
object to the setLog method via the hivemind configuration?

Thanks, Karthik

RE: Tap 4.0.2: How to enable Logging to log enhanced class source code??

Posted by James Carman <ja...@carmanconsulting.com>.
If there is a "log" property on your service implementation, then HiveMind
will automatically bind it with a Log object with the name of the service
point's id.  So, the ComponentConstructorFactoryImpl object gets a Log for
"tapestry.enhance.ComponentConstructorFactory" since that's its service
point id.  For more information on how HiveMind "autowires" stuff:

http://jakarta.apache.org/hivemind/hivemind/BuilderFactory.html#Autowiring

Note: the documentation will be moving soon once we get the HiveMind TLP
move completed.  

-----Original Message-----
From: Karthik N [mailto:karthik.nar@gmail.com] 
Sent: Friday, October 13, 2006 8:29 AM
To: Tapestry users
Subject: Re: Tap 4.0.2: How to enable Logging to log enhanced class source
code??

Kind of answering my own question:

log4j.logger.tapestry.enhance=DEBUG

does the trick. I can see the enhanced source code being printed.

The unanswered part for me, but more for academic interest is:
How the log4j configuration translates to hivemind knowing to create a new
Log object for the ComponentConstructorFactoryImpl is something I've not
been able to figure yet!!



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tap 4.0.2: How to enable Logging to log enhanced class source code??

Posted by Karthik N <ka...@gmail.com>.
Kind of answering my own question:

log4j.logger.tapestry.enhance=DEBUG

does the trick. I can see the enhanced source code being printed.

The unanswered part for me, but more for academic interest is:
How the log4j configuration translates to hivemind knowing to create a new
Log object for the ComponentConstructorFactoryImpl is something I've not
been able to figure yet!!