Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3618246
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:43:38+00:00 2026-05-18T22:43:38+00:00

I have a coldfusion website, and at one point we put in a log

  • 0

I have a coldfusion website, and at one point we put in a log – whenever a certain type of code was run, that code was logged. Now we’d like to take it out, but still have the option of putting it back in, so we’re planning on finding every time (there are probably hundreds) this code was logged and commenting out the logging code. This seems quite tedious to me and I was wondering if there’s some sort of way to mark code as testing and automatically enable/disable it by changing the settings in one place… I think I’ve seen functionality like this in other languages. Is this possible in ColdFusion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:43:39+00:00Added an answer on May 18, 2026 at 10:43 pm

    The way I would handle this is by configuring some sort of global application variable (e.g. doLogging) that you can switch on and off and check when needed. If it is set to true then log, otherwise don’t.

    For example in Application.cfc you could set up this variable:

    <cfcomponent displayname="Application" output="false">
    
    
     <cfset APPLICATION.doLogging= false />
    
     <cffunction name="onRequestStart" access="public" output="false"> 
    
      <cfif structKeyExists(URL, "toggleLogging")>
       <cfif APPLICATION.doLogging>
        <cfset APPLICATION.doLogging = false />
       <cfelse>
        <cfset APPLICATION.doLogging = true />
       </cfif>
    
      </cfif>
    
     </cffunction>
    
    </cfcomponent>
    

    And then check for it where needed in your code:

    <cfif APPLICATION.doLogging>
        <cflog file="foo" text="bar" />
    </cfif> 
    

    You will have to change your existing code though to use this new method, but managing it in future would be easier.

    Hope that helps!

    EDIT: changed variable names to be more sensible and added an example of use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a medium sized ColdFusion code base for our Intranet and Website. For
I have a coldfusion application running right now with a login that sends a
One my client has his website developed using coldfusion... Now I want to migrate
I'm working on a website that was coded in ColdFusion. I have a CSS/HTML
I have a ColdFusion script that does: <cfset content = replace(content,&##147;,,all)> Which replaces &147;
I have a Coldfusion CfChart Bar Graph, that has X-Axis = Questions, and Y-Axis
There is a website that was created using ColdFusion (not sure if this matters
I have a web-site written in ColdFusion that contains both the usual interactive web
Lately I have been finding that some of the ColdFusion applications on my production
We have a website in brazilian portuguese developed using Coldfusion (for the user interface),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.