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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:29:35+00:00 2026-05-16T21:29:35+00:00

Question Is it possible to make Log4J display the full path of the file

  • 0

Question

Is it possible to make Log4J display the full path of the file it used for configuration?


Background

I have a love-hate relationship with log4j. In good times, it’s great but when it’s not working, it can be one of the most difficult things to debug. I manage all the logging in our application. As such, I’m very familiar with logging and the default initialization procedure defined in the manual. Still, it seems that, every few weeks, logging breaks and I spend a lot of time sorting out the problem.

This time, it’s severely broken. Every single log statement everywhere is being dumped to the console and I can’t figure out why. The same exact code base that used my log4j.xml files last week, is suddenly using some other configuration. Nothing obvious has changed. My only guess is, a few dependencies have changed and I suspect Maven has downloaded some evil JAR that’s breaking everything.

If I could just figure out which configuration file Log4J decided to use at startup, I could tackle this and most other problems easily.


Summary

Is there some way to tell Log4J to print which file it used for configuration? Alternatively, is there a way to break a running application and use the debugger to answer this question (maybe with an expression or by inspecting variables)?

  • 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-16T21:29:36+00:00Added an answer on May 16, 2026 at 9:29 pm

    Yes, simply add log4j.debug to the JVM system variables. For example:

    java -Dlog4j.debug -cp ... some.class.name
    

    Log4j will then output something like the following:

    log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@1f7182c1.  
    log4j: Using URL [file:/C:/Users/matt/workspace/projectname/target/test-classes/log4j.xml] for automatic log4j configuration.  
    log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator  
    log4j: System property is :null  
    log4j: Standard DocumentBuilderFactory search succeded.  
    log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl  
    log4j: debug attribute= "null".  
    log4j: Ignoring debug attribute.  
    log4j: reset attribute= "false".  
    log4j: Threshold ="null".  
    ...
    

    For reference see the manual and the FAQ.

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

Sidebar

Related Questions

Question 1: Is css possible to make the corner of a img or a
Question Is it possible to get the version of the Java Plugin being used
Question: Is it possible to compile a program on linux using a .dll file?
quick question : Is it possible to make a pointer that can reference a
Very simple question, is it possible to make a variable that is retrieved from
I have to make an application of email client. is it possible to make
Is it possible to make url with custom literal separator that can have default
I have a domain-specific language with a certain syntax. Is it possible to make
This question is for my curiosity only: Is it possible to make a HTTP
I have this weird question. I would like to know if it is possible

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.