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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:42:12+00:00 2026-06-15T12:42:12+00:00

I have a maven project with several dependencies and use log4j.properties to control output.

  • 0

I have a maven project with several dependencies and use log4j.properties to control output. In some cases the same class may be referenced in different property files with different parameters. Is there a defined protocol for “overriding” properties or does it depend on the order in which packages are loaded?

(I am locating all log4j.properties directly under src/main/resources – is this the correct place?)

UPDATE:
I have accepted @Assen’s answer as it makes sense though it doesn’t make the solution easy. Essentially he recommends excluding log4j.properties from the jar. In principle I agree, but it puts the burden on the user to control the output and most of my users don’t know what Java is, let alone properties files.
Maybe there is a way of renaming the properties files in each jar and using a switch (maybe with -D) to activates the properties.

  • 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-15T12:42:14+00:00Added an answer on June 15, 2026 at 12:42 pm

    I often have similar discussions on projects. I thing log4j.properties is typically something you want to keep out of the application, and not pack it in a war and deliver it together with the code. Logging configuration:

    • is environment specific. When you write the application, you simply can’t define the appenders that will be desired, file locations etc.
    • its lifecycle is totally different than the application’s. After an application is deployed, logging properties can be changed several times a day. Redeploying the application shouldn’t override your last logging settings.

    Why package logging configuration together with your code then? I usually keep somewhere a configuration folder, with soubfolders like ‘dev’, ‘test-server-01’, ‘macbook-john’ etc. Each subfolder contains list own copy of log4j.properties. None of them is included in the build artifact – jar or war.

    When deploying, one of thuse subfolders is delivered separately. For the test server 1, this would be the content of test-server-01 subfolder. Dependng on the application server used, thers is a different trick tu put some files on the classpath.

    When developing, I take care to set one of those subfolders on the path. When John develops on his macbook, he might want to put ‘macbook-jihn’ on the classpath, or create a new one. He can change logging settings and commit without conflicts.

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

Sidebar

Related Questions

I have maven project with several modules. Need to deploy all modules( jars and
I have a maven project that contains a certain api I need to use
I have a maven project with several modules, One of these modules produces a
I have several independent projects (they don't have the same parent) but they use
I have maven parent project with several child projects. On deploy I want to
I have a multi-module maven project (several levels of nesting). Normally, when I execute
I am converting a project to use Ant/maven-ant-tasks. I have a local repository in
I have a project which uses several dependencies from the axis2 project. one of
I am currently trying to build a Java Project with several dependencies. I have
I have several Maven projects in eclipse that depends on each other. Some of

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.