Hey, I think I will probably go through and remove all the log4j stuff. Most of what is there was great in initial development of the AOP framework, but serves no real purpose at this point, and I rarely look at the traces anyway. 

Thanks, Chris


On Dec 9, 2006, at 5:21 PM, Dave Ross wrote:

Mitch,

Thanks for the head's up about the BD.NET issue - I'm thinking we
should remove the log4j dependency (or at least make it configurable)
with the next release of ColdSpring.

thanks,

Dave Ross

On 12/9/06, mitchsaleens <[EMAIL PROTECTED]> wrote:

There is a port of Log4J for J#, but is is for an older version of the
.NET framework so it won't work. So far, I have not found any great
reasons that Log4J is better than cflog (it does seem a little bit
cleaner), so here is the quick and dirty work around that I have
settled for.

Step 1: Create a logger component to mimic Log4J functionality.

<!---
$name: logger.cfc
$class: coldspring.custom.logger
 --->

<cfcomponent name="logger">


        <cfset variables.instance.type = ""/>
        <cfset variables.instance.isInfoEnabled = true/>
        <cfset variables.instance.isDebugEnabled = true/>


        <cffunction name="getInstance" access="public" returntype="any"
hint="Determines the name of log file. Is consistent with current
coldspring implementation.">
                <cfargument name="type" type="string" default=""/>
                        <cfset variables.instance.type = trim(arguments.type)/>
                <cfreturn this/>
        </cffunction>

        <cffunction name="isDebugEnabled" access="public"
returntype="boolean">
                <cfreturn variables.instance.isDebugEnabled/>
        </cffunction>

        <cffunction name="isInfoEnabled" access="public" returntype="boolean">
                <cfreturn variables.instance.isInfoEnabled/>
        </cffunction>

        <cffunction name="info" access="public" returntype="void">
                <cfargument name="msg" type="string" required="true"/>
                <cfset logMsg('information',arguments.msg)/>
        </cffunction>

        <cffunction name="error" access="public" returntype="void">
                <cfargument name="msg" type="string" required="true"/>
                <cfset logMsg('error',arguments.msg)/>
        </cffunction>

        <cffunction name="logMsg" access="private" returntype="void">
                <cfargument name="type" type="string" required="true"/>
                <cfargument name="msg" type="string" required="true"/>

                <cfif len(variables.instance.type)>
                        <cflog file="#variables.instance.type#" type="#arguments.type#"
text="#arguments.msg#"/>
                <cfelse>
                        <cflog type="#arguments.type#" text="#arguments.msg#"/>
                </cfif>
        </cffunction>


</cfcomponent>


Step 2: Replace all instances of:
CreateObject("java", "org.apache.log4j.Category")
with
CreateObject("component", "coldspring.custom.logger")


As I said earlier, I don't like altering framework code because it
makes it difficult to upgrade. This is as "low-impact" as I could
manage. Hope it helps anybody who has as similar problem.

-Mitch


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Mach-II for ColdFusion" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---




Reply via email to