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 8293587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:52:39+00:00 2026-06-08T13:52:39+00:00

I am new to cpp (come from Java). I am writing a cpp application.

  • 0

I am new to cpp (come from Java).
I am writing a cpp application. The application is performance critical.
i looked for a logging framework and i found log4cxx
at the end of the linked above there is performance section that explain:

When logging is turned off entirely or just for a set of levels, the
cost of a log request consists of a method invocation plus an integer
comparison

I remember from old days in university that we used then with #ifndf to wrap logging.

Questions:

  1. Is wrapping logging with #ifndf is still standard practice?

  2. Is there is something similar to the following pseudo-code?

logger.Log_Debug(() => { "My complicated log message " + thisFunctionTakesALongTime() + " will take no time" });
  • 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-06-08T13:52:40+00:00Added an answer on June 8, 2026 at 1:52 pm

    You can create your own macro that does nothing when in release mode:

    #ifdef _DEBUG
    #define LOG_DEBUG(x) logger.Log_Debug(x)
    #else
    #define LOG_DEBUG(x)
    #endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to C++ (just starting). I come from a Java background and
I am new to programming. I am porting cpp (WIN32) to cocoa framework. I
I come from a .NET world and I'm new to writting C++. I'm just
New to cpp (Java guy). I have 3rd party library that has method sendMail(txt).
I created a new HalloWorld Makefile Project. There is a HalloWorld.cpp with my main
New to PHP and MySQL, have heard amazing things about this website from Leo
I am working with vim. I created a new cpp file using vim xyz.cpp
How can I copy diff output ( diff old-version.cpp new-version.cpp ) into an Outlook
I'm new to write cpp in vim and I find the vim plugin is
I create sample application in that I was used first two Qwidget from UI

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.