Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

In java .properties config files

Posted on 2015-01-06
2
Medium Priority
?
225 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 36

Accepted Solution

by:
mccarl earned 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
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.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

971 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