Solved

In java .properties config files

Posted on 2015-01-06
2
156 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What language/protocol is the Angular Chat? 2 76
Java Options in Zimbra Server 2 54
expectj telnet failing 5 36
pagenation logic how it is working in my code 1 30
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

773 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