Rename log4j.properties

Some time the need arises to have our log4j.properties with different name. By default, if no other configuration is given, log4j will search your classpath for a 'log4j.properties' file.

Now to use your own named log4j property add the following line in your main program:

  PropertyConfigurator.configure("File  name with path")

exmaple:

 PropertyConfigurator.configure("c:\\logs\\my-log4j.properties")   this will set this as a default property name and all done =)

Leave a Reply

Your email address will not be published. Required fields are marked *