Solved

In java .properties config files

Posted on 2015-01-06
2
144 Views
Last Modified: 2015-01-23
Hi,
What advantage .properties config have since we need to restart the application everytime we make entry inside .properties config. How and where to use it. How to change log levels like debug etc using log4j with .properties config files. please advise with any working examples and resources. thanks in advance
0
Comment
Question by:gudii9
2 Comments
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 40534418
What advantage .properties config have since we need to restart the application everytime we make entry inside .properties config.
That is not exactly true. It's not inherent in .properties files that an application needs a restart to re-read the file. An application can be written so that it can detect changes to a .properties file and read it and reconfigure itself. However, unfortunately, probably a lot of library code does not do that and hence why you might perceive it that a restart is required.

How and where to use it.
Well they are useful as a lightweight way to configure aspects of your application. Alternatives include using a database, etc to configure your application but that implies more code and more dependencies to get the app working. Also, a .properties file may still be used in the above example as an initial "bootstrap" configuration to tell the application where to find the database that holds the rest of the configuration. There are many uses for it.


As for Log4J, if you can post a specific log4j.properties file that you have, it might be easier to show you how to modify log levels, etc.
0
 
LVL 7

Author Comment

by:gudii9
ID: 40554349
That is not exactly true. It's not inherent in .properties files that an application needs a restart to re-read the file. An application can be written so that it can detect changes to a .properties file and read it and reconfigure itself.

can you please advise on any example, sample code on this.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now