I have a business class, it specifies the org.apache.com mons. Logging. Impl. SimpleLog as logging implementation. Here’s the code.

public SimpleContactCreator(a){
		enableHeaderWireAndContextLogging();
	}
	
	private void enableHeaderWireAndContextLogging(a){
		System.setProperty("org.apache.commons.logging.Log"."org.apache.commons.logging.impl.SimpleLog");
		System.setProperty("org.apache.commons.logging.simplelog.showdatetime"."true");
		System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire.header"."debug");
		System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient"."debug");
	}
Copy the code

How is the SimpleLog implementation detected by HttpClient at runtime?

Log detection occurs when I call httpClientBuilder.create ().build() :

Check the method findUserSpecifiedLogClassName:

From the system in the property attribute org.apache.com mons. Logging, the Log value:

Here is my SimpleLog configuration.

For more of Jerry’s original articles, please follow the public account “Wang Zixi “: