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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:17:01+00:00 2026-06-14T12:17:01+00:00

I have a fairly simple Java application that is being distributed out to users

  • 0

I have a fairly simple Java application that is being distributed out to users as an executable JAR file. In order to track usage and assist in diagnostics, I want to add logging capability to the application but, from one execution to the next, I can never be sure where the users are going to be running this application.

In order to make this work, I have configured my application to use a log4j socket appender – no matter where the user is running this application, messages are sent to the socket and properly logged, which is perfect.

What I’m running into now, though, it that I would prefer to use different log4j configurations when I am running locally vs. when I deploy this application into production. When running locally (from my IDE, IntelliJ), I would prefer to use a console appender for a couple reasons:

  1. It’s trivial to see what is happening.
  2. Should I be developing without an Internet connection, I don’t want to hang up on not being able to connect.
  3. I don’t want to clutter the production logs with what I am doing during development.

When I package the application and distribute it, however, I would like it to use the socket appender, rather than the console appender.

Is there any easy way to accomplish what I want? I am using Maven to build my application, but I am not horribly skilled with it.

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

    Here’s a simpler approach to your problem…

    Put two log4j.properties files under src/main/resources directory, like this:-

    src/main/resources
    |- log4j.properties 
    |- log4j_dev.properties 
    

    log4j.properties contains the production configuration, and by default, Log4J will automatically pick this file up because you are using the standard file name.

    log4j_dev.properties contains the development configuration. To ensure IntelliJ picks this up during development, you will overwrite the log configuration using -Dlog4j.configuration=<configuration-file> VM option. I attached a screenshot on how you might configure this using IntelliJ:-

    enter image description here

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

Sidebar

Related Questions

I've written a fairly simple java application that allows you to drag your mouse
I have a fairly simple maven-ized Java project, but am having trouble getting my
I have a fairly simple python loop that calls a few functions, and writes
I have a fairly simple app that launches the camera from a menu. The
I work on a fairly simple but large two-tier application that consists approximately 40
I am playing with Google's AppEngine Java support. I have a fairly simple set
I have a fairly simple non-clustered application running ehcache with spring and hibernate. On
I have a fairly simple web2py form with a few validators like, IS_FLOAT_IN_RANGE(...) on
I have a fairly simple question, however the answer seems to elude me. If
I have a fairly simple query: SELECT invoice_id WHERE employee_id = 'XXXX' AND customer_id

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.