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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:51:32+00:00 2026-05-26T21:51:32+00:00

Packaging a log4j configuration file in a NetBeans Platform application apparently requires some thinking

  • 0

Packaging a log4j configuration file in a NetBeans Platform application apparently requires some thinking through. This is what I tried…

I put log4j.xml in src/main/resources/my/package/log4j.xml of some_netbeans_module. The package is a public module package (i.e. classes from this package are used from other packages). I rebuilt the module and confirmed that the file does, in fact, get packaged into the module.

In my classes I get an instance of the logger the way I always do:

static final Logger log = Logger.getLogger(ThisClass.class);

Every NetBeans Platform application has a my_app.conf file which makes it possible to set certain properties. This is where I set log4j.conf:

log4j.configuration="/my/package/log4j.xml"

Now, when I run the application, I see the following output:

[INFO] /home/me/my_app/application/target/my_app/bin/../etc/my_app.conf: 5:
log4j.configuration=/my/package/log4j.xml: not found

What is wrong with the above configuration?

  • 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-26T21:51:32+00:00Added an answer on May 26, 2026 at 9:51 pm

    In the my_app.conf file if you append the log4j.configuration property to the default_options property, like so:

    default_options="...<other options> -J-Dlog4j.configuration=my/package/log4j.xml"
    

    then this option will get passed to the JVM. Notice that the log4j property has -J-D appended to it. The -J is used by NetBeans to delineate JVM properties and the -D is used by the JVM to delineate a system property.

    Also you can/should drop the quotes and the initial / as the quotes are not necessary and NetBeans will complain if you have the initial /

    The other way to do this, and the way that I prefer since it doesn’t require editing the .conf file, is to put the log4j.xml file into the default package. If you have other requirements that prevents you from doing this then remember that you must put the log4j.configuration property in the app’s platform.properties file while your in dev mode and running the app inside of the IDE. Like so:

    run.args.extra=-J-Dlog4j.configuration=my/package/log4j.xml
    

    Edit: For questions regarding NetBeans Platform you might have better luck posting to the NetBeans Platform Users forum.

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

Sidebar

Related Questions

I'm packaging my java application into a jar file but it only packages the
I am in the process of packaging my java application into a jar file.
I'm packaging up a .NET 2.0 based web app for deployment through a Windows
We're in the process of packaging combinations of our products/modules. Some of them are
This San Mateo development company makes a freely downloadable convenient packaging of many plugins
I'm packaging a couple JMX MBeans inside a JBoss SAR file. However, when I
I have bumped into this concept using Python distutils2/packaging . I did google it,
I wrote a program that runs fine, however packaging the file into a jar
Python packaging tools expect that our readme file should be named README or README.txt.
What's the best option for packaging and distributing a command line application written in

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.