Changeset 1753
- Timestamp:
- 09/01/08 13:09:14 (4 months ago)
- Files:
-
- coldbox/trunk/system/extras/ColdboxProxy.cfc (modified) (6 diffs)
- coldbox/trunk/system/plugins/MTlogger.cfc (modified) (4 diffs)
- coldbox/trunk/system/plugins/logger.cfc (modified) (6 diffs)
- coldbox/trunk/system/util/util.cfc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
coldbox/trunk/system/extras/ColdboxProxy.cfc
r1663 r1753 36 36 /* Test Event Name */ 37 37 if( not structKeyExists(arguments, "#event.getEventName()#") ){ 38 throwit("Event not detected","The #event.geteventName()# variable does not exist in the arguments.");38 getUtil().throwit("Event not detected","The #event.geteventName()# variable does not exist in the arguments."); 39 39 } 40 40 … … 68 68 //Execute the post process interceptor 69 69 cbController.getInterceptorService().processState("postProcess"); 70 71 /* Request Profilers */ 72 pushTimers(); 70 73 } 71 74 catch(Any e){ 72 75 /* Log Exception */ 73 cbController.getExceptionService().ExceptionHandler(e,"coldboxproxy","Process Exception"); 74 75 /* Verify stacktrace */ 76 if( not structKeyExists(e,"stacktrace") ){ 77 e.stacktrace = ""; 78 } 79 80 /* Request Profilers */ 81 pushTimers(); 82 /* Custom throw. */ 83 throwit(e.message.toString(),e.detail.toString() & e.stacktrace.toString()); 84 } 85 86 /* Request Profilers */ 87 pushTimers(); 76 handleException(e); 77 /* Rethrow it */ 78 getUtil().rethrowit(e); 79 } 88 80 89 81 /* Determine what to return via the setting */ … … 136 128 } 137 129 catch(Any e){ 138 /* Intercept Exception */ 139 interceptData = structnew(); 140 interceptData.exception = e; 141 cbController.getInterceptorService().processState("onException",interceptData); 142 143 /* Log Exception */ 144 cbController.getExceptionService().ExceptionHandler(e,"coldboxproxy","Interception Exception"); 145 146 /* Request Profilers */ 147 pushTimers(); 148 149 /* Return */ 150 return false; 130 /* Handle Exception */ 131 handleException(e); 132 /* Rethrow it */ 133 getUtil().rethrowit(e); 151 134 } 152 135 … … 158 141 </cfscript> 159 142 </cffunction> 160 143 161 144 <!------------------------------------------- PRIVATE -------------------------------------------> 145 146 <!--- handleException ---> 147 <cffunction name="handleException" output="false" access="private" returntype="void" hint="Handle a ColdBox request Exception"> 148 <cfargument name="exceptionObject" type="any" required="true" hint="The exception object"/> 149 <cfscript> 150 var cbController = ""; 151 var interceptData = structnew(); 152 153 /* Get ColdBox Controller */ 154 cbController = getController(); 155 156 /* Intercept Exception */ 157 interceptData = structnew(); 158 interceptData.exception = arguments.exceptionObject; 159 cbController.getInterceptorService().processState("onException",interceptData); 160 161 /* Log Exception */ 162 cbController.getExceptionService().ExceptionHandler(arguments.exceptionObject,"coldboxproxy","ColdBox Proxy Exception"); 163 164 /* Request Profilers */ 165 pushTimers(); 166 </cfscript> 167 </cffunction> 162 168 163 169 <!--- Trace messages to the tracer panel ---> … … 196 202 <cffunction name="verifyColdBox" output="false" access="private" returntype="boolean" hint="Verify the coldbox app"> 197 203 <cfscript> 198 //Verify the coldbox app is ok, else throw 199 if ( not structKeyExists(application,"cbController") ){ 200 throwit("ColdBox Controller Not Found", "The coldbox main controller has not been initialized"); 201 } 202 else 203 return true; 204 //Verify the coldbox app is ok, else throw 205 if ( not structKeyExists(application,"cbController") ){ 206 getUtil().throwit("ColdBox Controller Not Found", "The coldbox main controller has not been initialized"); 207 } 208 else{ 209 return true; 210 } 204 211 </cfscript> 205 212 </cffunction> … … 284 291 </cfif> 285 292 </cffunction> 286 287 <!--- Throw Facade ---> 288 <cffunction name="throwit" access="private" hint="Facade for cfthrow" output="false"> 289 <!--- ************************************************************* ---> 290 <cfargument name="message" type="any" required="yes"> 291 <cfargument name="detail" type="any" required="no" default=""> 292 <!--- ************************************************************* ---> 293 <cfthrow type="coldboxproxyException" message="#arguments.message#" detail="#arguments.detail#"> 294 </cffunction> 295 <!--- Dump it Facade ---> 296 <cffunction name="dumpit" access="private" hint="Facade for cfmx dump" returntype="void"> 297 <cfargument name="var" required="yes" type="any"> 298 <cfdump var="#var#"> 299 </cffunction> 300 <!--- Abort it facade ---> 301 <cffunction name="abortit" access="private" hint="Facade for cfabort" returntype="void" output="false"> 302 <cfabort> 293 294 <cffunction name="getUtil" access="private" output="false" returntype="coldbox.system.util.util" hint="Create and return a util object"> 295 <cfreturn CreateObject("component","coldbox.system.util.util")/> 303 296 </cffunction> 304 297 coldbox/trunk/system/plugins/MTlogger.cfc
r1624 r1753 35 35 <cfscript> 36 36 super.Init(arguments.controller); 37 setThread(createObject("java", "java.lang.Thread")); 37 38 instance.thread = createObject("java", "java.lang.Thread"); 39 38 40 return this; 39 41 </cfscript> … … 62 64 ExtraInfo="#arguments.ExtraInfo#"> 63 65 <cfscript> 64 super.logEntry( Attributes.Severity,Attributes.Message,Attributes.ExtraInfo);66 super.logEntry(Severity=Attributes.Severity,Message=Attributes.Message,ExtraInfo=Attributes.ExtraInfo); 65 67 </cfscript> 66 68 </cfthread> … … 95 97 <cfscript> 96 98 try{ 97 if ( findNoCase("cfthread", getThread().currentThread().getThreadGroup().getName() ) ){99 if ( findNoCase("cfthread", instance.thread.currentThread().getThreadGroup().getName() ) ){ 98 100 return true; 99 101 } … … 107 109 </cfscript> 108 110 </cffunction> 109 110 <!--- Get/set thread object --->111 <cffunction name="getThread" access="private" returntype="any" output="false">112 <cfreturn instance.Thread />113 </cffunction>114 <cffunction name="setThread" access="private" returntype="void" output="false">115 <cfargument name="Thread" type="any" required="true">116 <cfset instance.Thread = arguments.Thread />117 </cffunction>118 111 119 112 </cfcomponent> coldbox/trunk/system/plugins/logger.cfc
r1736 r1753 32 32 <cffunction name="init" access="public" returntype="logger" hint="Constructor" output="false"> 33 33 <cfargument name="controller" type="any" required="true"> 34 <cfset super.Init(arguments.controller) /> 35 36 <!--- Setup Plugin Properties ---> 37 <cfset setpluginName("Logger")> 38 <cfset setpluginVersion("1.1")> 39 <cfset setpluginDescription("This plugin is used for logging methods and facilities.")> 40 41 <!--- log name without extension ---> 42 <cfset setLogFileName( URLEncodedFormat(replace(replace(getSetting("AppName")," ","","all"),".","_","all")) )> 43 44 <!--- The full absolute path of the log file ---> 45 <cfif settingExists("ColdboxLogsLocation")> 46 <cfset setlogFullPath( getSetting("ColdboxLogsLocation") )> 47 <cfelse> 48 <cfset setlogFullPath('')> 49 </cfif> 50 51 <!--- Available valid severities ---> 52 <cfset instance.validSeverities = "information|fatal|warning|error|debug"> 53 <!--- Lock Name ---> 54 <cfset instance.lockName = getController().getAppHash() & "_LOGGER_OPERATION"> 55 56 <!--- Return ---> 57 <cfreturn this> 34 <cfscript> 35 //super init it. 36 super.Init(arguments.controller); 37 /* setup properties */ 38 setpluginName("Logger"); 39 setpluginVersion("1.1"); 40 setpluginDescription("This plugin is used for logging methods and facilities."); 41 42 /* log name without extension */ 43 setLogFileName( URLEncodedFormat(replace(replace(getSetting("AppName")," ","","all"),".","_","all")) ); 44 45 /* The full absolute path of the log file */ 46 if ( settingExists("ColdboxLogsLocation") ){ 47 setlogFullPath( getSetting("ColdboxLogsLocation") ); 48 } 49 else{ 50 setlogFullPath(''); 51 } 52 53 /* Available valid severities */ 54 instance.validSeverities = "information|fatal|warning|error|debug"; 55 /* Lock Name */ 56 instance.lockName = getController().getAppHash() & "_LOGGER_OPERATION"; 57 instance.lockTimeout = 15; 58 59 return this; 60 </cfscript> 58 61 </cffunction> 59 62 … … 187 190 188 191 <!--- Append Message ---> 189 <cflock type="exclusive" name="#getLockName()#" timeout="120"> 190 <cftry> 191 <cffile action="append" 192 addnewline="true" 193 file="#getlogFullPath()#" 194 output="#formatLogEntry(arguments.severity,arguments.message,arguments.extraInfo)#" 195 charset="#getSetting("LogFileEncoding",1)#"> 196 <cfcatch type="any"> 197 <cfthrow type="ColdBox.plugins.logger.WritingEntryException" message="An error occurred writing an entry to the log file." detail="#cfcatch.Detail#<br>#cfcatch.message#"> 198 </cfcatch> 199 </cftry> 192 <cflock type="exclusive" name="#instance.lockName#" timeout="#instance.lockTimeout#" throwontimeout="true"> 193 <cffile action="append" 194 addnewline="true" 195 file="#getlogFullPath()#" 196 output="#formatLogEntry(arguments.severity,arguments.message,arguments.extraInfo)#" 197 charset="#getSetting("LogFileEncoding",1)#"> 200 198 </cflock> 201 199 </cfif> … … 211 209 <cfset var oFileUtilities = ""> 212 210 213 <cflock name="# getlockName()#" type="exclusive" timeout="120">211 <cflock name="#instance.lockName#" type="exclusive" timeout="#instance.lockTimeout#" throwontimeout="true"> 214 212 <!--- Determine First Run ---> 215 213 <cfif arguments.firstRunFlag> … … 259 257 <cfargument name="reinitializeFlag" required="false" default="true" type="boolean" hint="Flag to reinitialize the log location or not." > 260 258 <!--- ************************************************************* ---> 261 <cflock name="# getLockName()#" type="exclusive" timeout="120">259 <cflock name="#instance.lockName#" type="exclusive" timeout="#instance.lockTimeout#" throwontimeout="true"> 262 260 <cffile action="delete" file="#getLogFullPath()#"> 263 261 </cflock> … … 295 293 <cffunction name="getvalidSeverities" access="public" hint="Get the validSeverities" output="false" returntype="string"> 296 294 <cfreturn instance.validSeverities > 297 </cffunction> 298 299 <!--- Get Lock Name ---> 300 <cffunction name="getlockName" access="public" output="false" returntype="string" hint="Get lockName"> 301 <cfreturn instance.lockName/> 302 </cffunction> 303 295 </cffunction> 304 296 305 297 <!------------------------------------------- PRIVATE -------------------------------------------> … … 392 384 393 385 <!--- Zip Log File ---> 394 <cflock name="# getlockName()#" type="exclusive" timeout="120">386 <cflock name="#instance.lockName#" type="exclusive" timeout="#instance.lockTimeout#" throwontimeout="true"> 395 387 <!--- Should I remove log Files ---> 396 388 <cfif qArchivedLogs.recordcount gte getSetting("LogFileMaxArchives",1)> coldbox/trunk/system/util/util.cfc
r1631 r1753 26 26 </cffunction> 27 27 28 <cffunction name="rethrowit" access="public" returntype="void" hint=" " output="false" >29 <cfargument name="throwObject" required="true" type="any" hint=" ">28 <cffunction name="rethrowit" access="public" returntype="void" hint="Rethrow an exception" output="false" > 29 <cfargument name="throwObject" required="true" type="any" hint="The exception object"> 30 30 <cfthrow object="#arguments.throwObject#"> 31 31 </cffunction>
