Solved

In java .properties config files

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
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…

763 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