- LogManager class looks for the system property log4j.configuration
- if is not defined, then it tries to look for a resource named log4j.properties/log4j.xml in the application classpath
- it then attempt to convert the defined configuration resource string to a URL object. If the resource string cannot be converted into a valid java.net.URL object , then it throws a Exception
- if no resource can be found, the initialization is aborted.
- if the resource is found and if it is a normal java properties-style file containing configuration information in a key-value format, then the PropertyConfiguration class is used to parse the configuration file. If the configuration file is an XML file, the DOMConfiguration class is used to parse the XML file and initialize the logging objets.
- initialzation through VM Parameters
log4j accepts three seperate VM parameters in the initialization process. they are:java
- log4j.configuration
- log4j.configurationClass
- log4j.defaultInitOverride
- log4j.debug