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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:33:55+00:00 2026-05-15T14:33:55+00:00

I am developing an Apache module. During development I found it convenient to use

  • 0

I am developing an Apache module. During development I found it convenient to use logging functions at various points in my code.
For example after opening a file, I would log an error if the operation was not successful so that I may know exactly where the problem occurred in my code.

Now, I am about to deliver my module to my boss (I am on an internship). I wanted to what are the best practices regarding logging. Is it good for maintenance purposes or is it bad because it may hamper the response time of the server.

  • 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-15T14:33:56+00:00Added an answer on May 15, 2026 at 2:33 pm

    It really depends on how you wrote those logging instructions. If you wrote:

    logger.debug(computeSomeCostlyDebugOutput());
    

    You might affect performance badly if the logger is not set on a DEBUG level (computeSomeCostlyDebugOutput will always take time to execute and its result will then be ignored by the logger if not matching the DEBUG level).

    If you write it like this instead:

    if (logger.isDebugEnabled()) {
      logger.debug(computeSomeCostlyDebugOutput());
    }
    

    then the costly operations and logging will occur only if the correct logger level is set (i.e. the logger won’t ignore it). It basically acts like another switch for the logger, the first switch being the configured logger level.

    As Andrzej Doyle very well pointed out, the logger will check its level internally, but this happens in the debug method, after time was already wasted in the computeSomeCostlyDebugOutput. If you waste time in computeSomeCostlyDebugOutput, you better do it when you know that its result won’t be in vain.

    A lot of software ships with logging instructions which you can activate if you need more details into the inner workings of the thing, execution path and stuff. Just make sure they can be deactivated and only take computing time if the appropriate level is set.

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

Sidebar

Related Questions

I am currently developing a module for Apache 2/2.2 and need to perform some
i installed joomla,apache server,php,mysql in my pc, after that how to start developing web
I'm developing a apache module and a shared library in the same Autoconf/Automake project.
I am developing a demo app using Servlet/JSP and using logging JAR by apache
While developing a Django app deployed on Apache mod_wsgi I found that in case
I want to add logging to an application I am developing, using apache log4j.
I am developing a mobile webapp using JSF and Apache myFaces 1.2.9. During authentication
I'am developing application based on apache MINA. For secure data transmission I use SSL.
I am using org.apache.log4j.Logger for logging and I am developing a jsp just for
We're currently developing a website (TYPO3 under Apache) for a customer that is supported

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.