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

  • Home
  • SEARCH
  • 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

One my client has his website developed using coldfusion... Now I want to migrate
Using openID has brought up some questions that I'm hoping the SO community can
I am building a website where i need a page where user can upload
Alright, I am hoping someone can help me out. I apologize up front that
I've been looking all over the web for a ColdFusion-based SQL administration tool for
I have some* experience using the flex framework for building web apps. But I
I have development server setup running Adobe Coldfusion8 (.war install) on top of Caucho
I ran across a new problem in the last week. Due to the nature
Yay, first post on SO! (Good work Jeff et al.) We're trying to solve
I can't seem to get the magic combination of enabling NTLM authentication and still

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.