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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:56:48+00:00 2026-05-27T08:56:48+00:00

I want to read log4j.xml file which is outside the jar inside etc folder.

  • 0

I want to read log4j.xml file which is outside the jar inside etc folder. So i created manifest file as follows

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_24-b07 (Sun Microsystems Inc.)
Built-By: Administrator
Main-Class: com.him.LogPrinter
Class-Path: ./lib/log4j.jar ./etc/log4j.xml

My class file is as follows

package com.him;
import org.apache.log4j.Logger;
public class LogPrinter {

/**
 * @param args
 */
public static Logger logger = Logger.getLogger(LogPrinter.class);
public static void main(String[] args) {
    logger.debug("I am a debug message");
    logger.info("i am a info message");
    logger.error("i am a error message");
    logger.warn("i am a warn message");
    System.out.println("hello");
}

}

when i run my jar file using

java -jar myapp.jar

it shows usual exception of no appender could be found for logger and no log file generated.

When I put log4.xml file inside jar file it gives the required output.

Please help I am not able to figure out why configuration file is not picked even if it is in classpath configured using manifest.mf file.
Thanks in advance.

  • 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-27T08:56:49+00:00Added an answer on May 27, 2026 at 8:56 am

    You would need to specify the directory, not the file; like a normal classpath.

    I’m not sure I like this idea, though; I think it would be more convenient to supply a config file path on the command line.

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

Sidebar

Related Questions

I have an xml file, inside views folder and I want read it, before
I want to read an xml file, apply a transform, then write to another
Hi programmers, I want read line by line a Unicode (UTF-8) text file created
I have a text file. I want read that file. But In that if
I want to read line n1->n2 from file foo.c into the current buffer. I
I want to read an specific xml node and its value for example <customers>
I want to read each line from a text file and store them in
I want read the content of file and store it in array. I have
I want to open some file from my application, file are created by the
i want read data from the binary file named xyz.bin and want to parse

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.