Logging calls to cfcs

Howdy gang!
I have inherited an application with a fairly large number of cfcs. The codebase goes back quite a few years. Though the code is in mostly decent shape, as with most long lived apps, there are files no longer in use, etc.
I am hoping to figure out a way to monitor cfc usage. Ideally, I would be getting something like:
* cfc name
* method
* file called from
* maybe args passed 
I would stuff this info in to a table, so I can basically select all cfcs that have not seen any use in a given time period.
Coming up completely blank on this one. Any ideas? Thanks!

/Web-inf/debug/ directory (classic.cfm is the classic debugging that is visible at the end of the page)
Indeed. The key code is
<cfobject action="CREATE" type="JAVA" class="coldfusion.server.ServiceFactory" name="factory">
<cfset cfdebugger = factory.getDebuggingService()>
<cfset qEvents = cfdebugger.getDebugger().getData()>
qEvents is a query. What you want to get your grimy mitts on is that query's template column.
However, I should be wary of tampering with any of the files in /WEB-INF/debug/, as they are system files. Another consideration is load. The files in WEB-INF bootstrap a web application, and are generally meant to run before every request. Therefore, you wouldn't want to add any heavy-duty code in there.
I can think of two ways around that. In either case you create a  temporary debug file with the sole purpose of logging the templates that your applications open. You will delete the files when you've collected enough information.
The first possibility is to make a copy of classic.cfm, say, /WEB-INF/debug/myClassic.cfm. Then, in myClassic.cfm, you may add the following line immediately after <cfset qEvents = cfdebugger.getDebugger().getData()>:
<cflog file="templates" text="#qEvents.template#">
Alternatively, you can just create your own debug file, say,  /WEB-INF/debug/templateLogger.cfm. The file templateLogger.cfm would contain the barest minimum code you need for the job, namely
<cfobject action="CREATE" type="JAVA" class="coldfusion.server.ServiceFactory" name="factory">
<cfset cfdebugger = factory.getDebuggingService()>
<cfset qEvents = cfdebugger.getDebugger().getData()>
<cflog file="templates" text="#qEvents.template#">
In fact, as you will see in a moment, you may choose to implement both myClassic.cfm and templateLogger.cfm. After all, you will only be able to apply one at a time! How then?
In the Coldfusion Administrator, of course. Go to the section on Debugging & Logging. You will find that all the files in /WEB-INF/debug/ appear as a drop-down list entitled, "Select Debugging Output Format". You can only choose one!
Tick the checkbox "Enable Request Debugging Output". Click the button to submit the changes, and you're in business.

Similar Messages

  • Who called a CFC

    is there a way to find out who invoked a CFC? I would like to
    check and log who the calling .CFM or .CFC file is from within the
    CFC being invoked. Sort of like back in the Custom Tag days, I need
    to know which templated called me. I am looking at the
    GetMetaData() and GetPageContext() functions but nothing stands out
    yet as how to do what I need to do.
    Thanks All for the Posts below,
    This is a pretty tough one, and I wish I could diagram it to
    help explain.
    cfc1
    cfc2
    cfc55
    In any of these CFC's, we have code wraped in try/catch
    statements. When an exception is thrown, the catch statements kick
    in. in the catch blocks, I invoke a cfc called myErrorCFC.cfc..
    err = createObject("component", "myError");
    From there inside of the catch block I am invoking a method
    (see below) which performs legancy handling/logging.
    err.parseException(cfcatch.Message);
    What I now need to do is extend that method to log who thrown
    the exception. Yes the simple way is to pass the name of the cfc or
    cfm page as an argument, but changing the code which invokes the
    err cfc is out of my control. So I am left with trying to solve
    this the hard way.
    So far this is where I am at (in my "myErrorCFC.cfc", invoked
    from within the catch blocks) which is not currently working:
    tmp = getPageContext().getException();
    This does not work but it may clearify the approach I am
    taking. Does anyone have any good ideas on how to return the error
    object from the JRun/jsp/java side of things. "getPageContext()"
    returns a "coldfusion.runtime.NeoPageContext" object. The end
    result I am trying to achieve is simply (ha ha) to find out which
    cfc or cfm page that the exception was thrown and having access to
    any additional info would be benificial as well.
    Any help will be appriciated greatly.
    Thank you,
    Erik

    Thx for your response, passing an argument would idealy be
    the simplest approach but in the context of the problem it would
    not be posible. I am working with a VERY large application and to
    do so would mean modifying hundreds of lines of code where the CFC
    I'm invoking is called from throughout the system. With large
    legancy systems as you know, it's always exceptable to make
    sweeping changes through sensitive code. If I end up not being able
    to find a method in which to find who invoked the CFC I am
    modifying I will just have to live with the fact. Idealy I want to
    be able to track and log who it was that initiated the CFC. That
    can come from a number of model cfm files or cfc's.

  • RPC fault when calling a CFC from flex

    Hello there,
    I'm having some startup problems getting Flex and Colfusion 8
    to play nice with FDS. I'm using Flexbuilder 2.0.1 and Coldfusion 8
    developer edition on IIS on a windows box (XP professional).
    I use a very simple test CFC in my coldfusion site with just
    one function called 'getstring' which, surprise, surprise returns a
    string. I want to show this string on a label in my Flex frontend
    by using <mx:remoteobject>, the whole thing compiles
    perfectly, I use this mxml:
    <mx:RemoteObject id="TestService"
    source="cfc.DataTest"
    destination="ColdFusion"
    concurrency="multiple"
    makeObjectsBindable="true"
    showBusyCursor="true">
    <mx:method name="getString"
    result="doResult(event.result)" fault="doFault(event.fault)"/>
    </mx:RemoteObject>
    but after calling the remote method I get this error back:
    [RPC Fault faultString="coldfusion.xml.rpc.CFCServlet cannot
    be cast to coldfusion.runtime.CFPage" faultCode="Server.Processing"
    faultDetail="null"]
    Which is the same type of error I get when I call a CFC
    directly through the address bar in my browser, for example
    http://localhost/cfc/datatest.cfc
    I tried googling the error message but so far found nothing
    that indicated what I'm doing wrong...
    I'd really appreciate some help here, if you need more info
    let me know...
    thanx in advance

    Ok, nevermind, I figured out what I was doing wrong. I had
    accidentally setup my application.cfc in a wrong way, I had set all
    of the onrequest en onapplication event handlers to
    access="package" instead of "public", this generated an error
    ofcourse...
    I'll just go bang my head against a wall for a while
    now....

  • Strange issue on log call.. calls registered in log ...

    i had this problem..
    i have some calls registered on my log calls that i never done!
    some of them are incoming and other outgoing... i notice this on a contact that i was checking the relative contact sheet .. i received a phone call from another contact and later i recognized that my phone logged different calls for that contact i was checking
    does anyone experienced the same issue? and in case what the reason? or cause?
    thanks in advance
    ps sorry for bad english

    I had same issue either, yesterday...
    Happen after last update on my iPhone 5.
    I had opened the contact list and after i received a call fot that contact and the contact called me, system registered a couple of calls in and out not happened.
    strange issue.. i ll try sw reset as Jason suggested..

  • Cisco Supervisor Desktop show "Agent Logs - call" and "Agent Logs - state" in N/A ::: UCCX 8.5.1

    Hi team.
    The Cisco Supervisor Desktop don't show any logs in the "Agent Logs - State" and "Agent Logs - Call" in some agents.
    I restarted the Cisco Desktop Services in CCX Serviceability but the issue continue.
    I appreciate any help respect this case.
    Thanks a lot.
    ErnestoG

    Hi Ernesto,
    Did you click or selct the Specific Agent\Inbound call which is currently being handled by the Agent. From the Screenshot you have attached (first one) doesn't look like the call has been selected.
    Please select or click on that Specific Agent\Inbound call from CSD and check these values.
    Hope this helps.
    Anand
    Please rate helpful posts !!

  • History log calls, name changed

    I received a call from a person A and in the history log call is shown as person B, but if I try to call it link me to the person A who originaly called me. It semmed that changes the names. It is a mess. It started to happen after butt upgrading to v. 10.1.0.273 in the z10. Is there any fix? Thanks

    Hi and Welcome to the Community!
    Unfortunately...refer:
    KB34577 Caller ID shows incorrect contact information for incoming calls and calls placed from the call log go to a different phone number than intended
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Is it possible to log calls with address book?

    Does anyone know how to log calls with address book - I usually dial right out of addessbook (via blue tooth) and always get the incoming calls as pop-ups on my screen. I was wondering if address book is logging them anywhere that I could access. I would appreciate anybody's help! Thanks, Paul

    Thanks for the response. Sometimes I just think my macs can do anything!
    I often use the incoming phone info through caller to create/ update contacts. Perhaps there is something third- party out there that will fill the bill.
    Anyway, have a great day! Paul

  • Calling a cfc through a udf

    Is it possible to call a cfc function through a udf, or maybe im just looking at this the wrong way but here is what im ultimately trying to do.
    I have the following table:
    tbl_users
    =====================
    uid                         name
    =====================
    1                         John
    2                         Steve
    3                         Joe
    4                         Bob
    Then throughout the program i am given a few of the uid, and i have to loop through them and get the names, so im trying to figure out a way to make a function so i can call it like this and it checks the db and gives me the name:
    getName(uid) = returns name
    Is there any easy way of doing something like this?

    case 1: user-defined function alone
    <cffunction name="getNameFromId">
        <cfargument name="id" default="1">
        <cfset var selectedUser = "">
        <cfset user = arrayNew(1)>
        <cfset user[1] = "John">
        <cfset user[2] = "Steve">
        <cfset user[3] = "Joe">
        <cfset user[4] = "Bob">
        <cfset selectedUser = user[arguments.id]>
        <cfreturn selectedUser>
    </cffunction>
    <cfoutput>#getNameFromId(3)#</cfoutput>
    case 2: (a) content of CFM page userName.cfm
    <cfset userObject = createobject("component", "User")>
    <cfoutput>#userObject.getNameFromId(2)#</cfoutput>
    <!--- Alternative, using cfinvoke --->
    <!---
    <cfinvoke component="User" method="getNameFromId" returnVariable="userName">
        <cfinvokeargument name="id" value="2">
    </cfinvoke>
    <cfoutput>#userName#</cfoutput>
    --->
    (b) The user-defined function is in a component saved as User.cfc in the same directory as the page userName.cfm
    <cfcomponent displayname="User">
    <cffunction name="getNameFromId">
        <cfargument name="id" default="1">
        <cfset var selectedUser = "">
        <cfset user = arrayNew(1)>
        <cfset user[1] = "John">
        <cfset user[2] = "Steve">
        <cfset user[3] = "Joe">
        <cfset user[4] = "Bob">
        <cfset selectedUser = user[arguments.id]>
        <cfreturn selectedUser>
    </cffunction>
    </cfcomponent>

  • Is the directory watcher multi-threaded once it calls the cfc?

    the docs say there's a single thread that watches the directory.  But say for example it finds 3 files and calls the cfc.  At that point do all 3 files run one at a time on a single thread in the order they came in, or do they run at the same time on multi-threads?

    I think I understood your questions. There were more than one, some implicit. Here are my answers:
    ColdFusion runs the directory-watcher in a single thread.
    During the execution of the same thread, ColdFusion detects whether of not a file has, or any number of files have, been added, deleted or changed.
    When ColdFusion calls the CFC, it does so in that same single thread. My guess is that any file add-events, delete-events and change-events are queued and handled one after the other.

  • Calling a CFC in a subdirectory

    I'm trying to figure out how to use cfinvoke to call a cfc sitting in a subdirectory...
    It's apache with userdir turned on (so each user that has a public_html directory in their homedir can have a site)
    The resulting logical path looks something like this:
    /~user/CFC/component.cfc
    /~user/test.cfm
    I don't know what to put in test.cfm for it to see component cfc... Usually we would have the CFC directory in document root, so I would just be able to put <cfinvoke component='cfc.component'> but that's not the case now...
    Thanks

    Thanks for the response. Web root is still /. Each user just gets a subdirectory off web root when UserDir is enabled, so /CFC did not work... Neither did ../CFC/ unfortunately, not even ./CFC/
    The only way I can make it work is if I put the .cfc in the same dir as the script, which is OK for now but will not be practical once I have a whole list of them.

  • C2-01 Call log & Call cost feature is missing...

    Recently i updated nokia c2-01 with new firmware version 11.10, no problem occur..
    but in dial call log there is no call summary feature in NOKIA C2-01, there is only latest call duration option, but no call history option, and no call cost feature & call management as compared to other nokia phone, just like NOKIA 1209... 
    one problem is also occur , when i play any music from media player, during play  i open any msg or apply any new theme my phone is restart... 
    If I have helped you, please hit the star at the bottom of my posts - it's appreciated!
    Don't forget if your problem is solved to press the "Accept as Solution" button.

    There is a long thread on this at another forum..
    http://www.dslreports.com/forum/r23501543-IMG-Caller-ID-on-in-New-York
    It is normal for the box to start showing the option before it's actually live.
    You won't need any service call or change of equipment. it will just start working when it's live.
    From that thread some areas of NY have it. Verizon doesn't announce schedules on anything too much so you are highly unlikely to get an answer to "when".

  • Logging Call Bandwidth Usage on MCM

    I have a need to add a field to my videoconferencing call detail records that includes the bandwidth used by H.323 calls on a per call basis. I am currently logging my CDR to a radius server, but after parsing the output, I cannot find any fields corresponding to the bandwidth of the call (i.e. 384K,512K, 768K, etc.) Any help would be appreciated. Thanks.

    for what it's worth, I have not seen a bandwidth indicator in my call detail records either.
    The best I have been able to acheive is billing based upon the tech prefixes dialled when placing H.320 calls via the 3540 gateway.

  • $25 Reward - Calling a CFC via Remote Object or Web Service without making the result public

    I am just getting into Flex 2, so please forgive me for my
    newbe vocab.
    Here is how my applications have worked in the past, i.e.
    ColdFusion:
    <cfscript>
    //Create an instance of component
    order = CreateObject( 'component', 'PEK.Catalog.Order' );
    //Call methd
    theOrder = order.getOrder(1234);
    </cfscript>
    Display the order via HTML and CFML.
    getOrder() returns a query and 1234 is a sample orderID. The
    most important part of the solution I am looking for is that the it
    must not expose my getOrder() as a public web service. I am able to
    run the application with WS by making the mothod URL visible and
    remote, but this is no way near the security I would like to have.
    Here is my folder structure where components folder has been maped
    to CF.
    Application
    |__extentions
    | ... |__components
    | ... ... |__PEK
    |__wwwroot
    I guest there should be a way to call CFC with the thing
    remote object that I have no idea how to set up. So please what
    would be a solution to my security issues.
    Thank you in advance!

    Click
    Here for Link to Article
    I guess this article answers part of the question. It is very
    important to note that if the CFC is sitting on the same server as
    the CFC the component methods could be public and not remote, thus
    making it alot more secure.

  • Logging calls in SPA9000

    Hi all,
    Is it possible to log/record outgoing calls (phone number + duration) in a SPA9000?
    THankx

    Hi me_grimlock,
    How does this syslog data look like? Is it possible to grep (tcl, perl, etc) outgoing calls+IP+duration?
    If ones requires 3rd-party SW (I read somewhere the linksys partners get this syslog daemon) + a PC running the syslog daemon then it may be more attrative to run an asterisk server on its own, doesn't it? 
     THanks

  • E51 - Not Logging Calls

    Hi 
    I own a Nokia E51 and for some reason just recently too I might add, it doesnt log any calls. Missed, Dialled or Recieved.
    I was wondering if it could be fixed, like have I accidently pressed something or changed a setting !! ....  
    Thanks in advance .. !! 

    Support forum ???????????? 

Maybe you are looking for