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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:58:31+00:00 2026-06-15T16:58:31+00:00

For performance wise what is better to use to include the class name in

  • 0

For performance wise what is better to use to include the class name in the log? In the pattern layout it gives a warning in the documentation for %F saying:

Used to output the file name where the logging request was issued.
WARNING Generating caller location information is extremely slow and should be avoided unless execution speed is not an issue.

  • 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-15T16:58:33+00:00Added an answer on June 15, 2026 at 4:58 pm

    To get the className log4j makes a call something like.

    String className = new Throwable().getStackTrace()[3].getClassName();
    

    As you can see this does a lot of work for a simple result. Using getClass().getSimpleName() is relatively more efficient, but if you can cache this it would be better.

    HotSpot internally has this method, which I believe is not used as it’s internal use only. IMHO, it would have been better if it detected if this were available and use it if it is.

    Class class = sun.reflect.Reflection.getCallerClass(int stackDepth);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since Modernizr.load and Yepnope are asynchronous loaders, is it better performance-wise to use them
For performance wise, some people suggest use the following method, e.g. public class MyActivity
What is better for performance wise declaring the variable outside the foreach statment and
what do you think would be performance-wise the better way to get the category-names
Performance wise, what is better? If I have 3 or 4 join statements in
I wanted to know what is better performance-wise: to put the conditions in the
Which method is better (performance-wise) if I have DataBoundControl such as GridView, Repeater, and/or
Design wise and performance wise which approach is recommended for handling multiple Zeromq sockets
I'm wondering if there is a difference performance wise between using COUNT(*) and COUNT(date_created)
Any difference, performance-wise?

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.