?
Solved

In java .properties config files

Posted on 2015-01-06
2
Medium Priority
?
200 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

752 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