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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:50:54+00:00 2026-06-16T10:50:54+00:00

I am trying to implement logger using apache commonn logging and log4j.xml file as

  • 0

I am trying to implement logger using apache commonn logging and log4j.xml file as configuration file .

So in the actual java code i am writing log as

I am using appache common logging

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

and i am logging information such as in . I am creating a instance of log for each class

 private static Log    logger  = LogFactory.getLog( MyClass.class );
    private static final String      name   ="SAM";
    logger.info("name= "+name);
  1. So now my question is does implementing logger like this create a performanace issue?

  2. Is it necessary to check log like

    if ( log.isInfoEnabled( ) ) 
     {
      log.info( "Info message" );
      }
    

The confusion is mainly because in Apache common logging they have mentioned to do this and in log4j they have mentioned it is unnecessary.

Each time when we write log in the files?

-Sam

  • 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-16T10:50:56+00:00Added an answer on June 16, 2026 at 10:50 am
    1. yes and no, logging always reduces your performance, but some functions are more expensive then others, e.g. getting the calling class/method-Name uses reflection and is very slow. But a normal logfuntion is not that expensive if you do not have an expensive statement in the calling logging function (this will be evaluated every time before the log-Level is checked. In this case you can use the .isLevelEnabledcheck to prevent the evaluation). Also logging to the console takes longer for the output than logging to a file. You will find more information about this by googling and in the FAQ/manual of log4j.

    2. You do not have to check the Log-Level before logging. This is done within the log-function itself. Therefore are the different methods for every Level or the Level-Argument in the generic log-Method.

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

Sidebar

Related Questions

I am trying to fully implement a resumable file upload system in Java. The
I'm trying to implement websockets using Tornado webserver. My setup looks as follows: from
I'm trying to implement a custom log4net logger/logmanager so that I can add a
I'm using acts_as_taggable_on in a model, and am trying to implement the auto_complete plugin.
I'm trying to implement drag and drop in Silverlight using F# and asynchronous workflows.
I am trying to implement a TCP server and using python script. So I
I am trying to implement a modal window using jqModal plug-in. I make an
I'm trying to implement Facebook Connect on a website with .NET MVC using C#.
I'm trying to implement Gauss-Newton optimization for a specific problem on iPhone ARM using
Hey guys, I'm currently trying to implement a function using C that takes in

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.