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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:21:44+00:00 2026-05-25T20:21:44+00:00

I am creating a jar file that i need to provide to client, but

  • 0

I am creating a jar file that i need to provide to client, but my client is asking for separate logger for the jar file as this is doing some integration work.

anyone can suggest how can i create logger for only one jar file, can i put log4j.properties in same jar file.

I am using web-logic server. we will not deploy this jar file instead we will just keep it in domain lib folder.

Thanks

  • 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-25T20:21:45+00:00Added an answer on May 25, 2026 at 8:21 pm

    If the properties file is in the jar, then you could do something like this:

    Properties props = new Properties();
    props.load(getClass().getResourceAsStream("/log4j.properties"));
    PropertyConfigurator.configure(props);
    

    The above assumes that the log4j.properties is in the root folder of the jar file.

    If this does not work for your needs in this case then you can always use:

    -Dlog4j.configuration=log4j_for_some_jar.properties
    

    If the other application is using Log4j as well. The easier method would be to just config your log4j file to send anything from your classes in your jar to a new log file like so:

    log4j.rootLogger=ERROR, logfile
    
    log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.logfile.datePattern='-'dd'.log'
    log4j.appender.logfile.File=log/radius-prod.log
    log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
    log4j.appender.logfile.layout.ConversionPattern=%-6r %d{ISO8601} %-5p %40.40c %x - %m\n
    
    log4j.logger.foo.bar.Baz=DEBUG, myappender
    log4j.additivity.foo.bar.Baz=false
    
    log4j.appender.myappender=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.myappender.datePattern='-'dd'.log'
    log4j.appender.myappender.File=log/access-ext-dmz-prod.log
    log4j.appender.myappender.layout=org.apache.log4j.PatternLayout
    log4j.appender.myappender.layout.ConversionPattern=%-6r %d{ISO8601} %-5p %40.40c %x - %m\n
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a jar file using eclipse IDE. But I am facing
I'm creating a .jar file that has a GUI: jar cmf mainClass patcherFull.jar pack
I am creating a jar file of a javaagent that I have written. However,
I am creating a program that will download a .jar (java) file from a
I have a problem creating and executing a JAR file. I have already made
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
I'm trying to use Maven to create an executable jar file that includes the
I need to add some jars from JRE7 library to my Android project. But
Separate Jars When creating JAR files, I've always kept the source separate and offered
I’m creating an executable JAR that will read in a set of properties at

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.