Skip to content

Commit

Permalink
Merge pull request #5242 from pkriens/master
Browse files Browse the repository at this point in the history
[httpclient] Implement log as specified in doc
  • Loading branch information
pkriens committed May 9, 2022
2 parents 484abbf + 499c74a commit ebec1d6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Expand Up @@ -85,7 +85,6 @@ private void assertOk(String username, String password, boolean verify) throws E
p.setProperty("-connection-log", log.toURI()
.getPath());
p.setProperty("-connection-settings", settings);
hc.setLog(log);

ConnectionSettings cs = new ConnectionSettings(p, hc);
cs.readSettings();
Expand Down
Expand Up @@ -35,6 +35,7 @@
import aQute.bnd.header.Attrs;
import aQute.bnd.header.Parameters;
import aQute.bnd.http.HttpClient;
import aQute.bnd.osgi.Constants;
import aQute.bnd.osgi.Processor;
import aQute.bnd.osgi.Processor.FileLine;
import aQute.bnd.service.url.ProxyHandler;
Expand Down Expand Up @@ -73,6 +74,13 @@ public class ConnectionSettings {
public ConnectionSettings(Processor processor, HttpClient client) throws Exception {
this.processor = Objects.requireNonNull(processor);
this.client = client;
String logfile = processor.getProperty(Constants.CONNECTION_LOG);
if (Strings.nonNullOrEmpty(logfile)) {
File file = IO.getFile(logfile);
file.getParentFile()
.mkdirs();
this.client.setLog(file);
}
mavenMasterPassphrase = new MasterPassphrase(processor);
}

Expand Down
2 changes: 2 additions & 0 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/Constants.java
Expand Up @@ -116,6 +116,8 @@ public interface Constants {
String DEFINE_CONTRACT = "-define-contract";
String CONDITIONALPACKAGE = "-conditionalpackage";
String CONNECTION_SETTINGS = "-connection-settings";
String CONNECTION_LOG = "-connection-log";

String COMPRESSION = "-compression";
String DIFFIGNORE = "-diffignore";
String DIFFPACKAGES = "-diffpackages";
Expand Down
2 changes: 1 addition & 1 deletion docs/_instructions/connection-settings.md
Expand Up @@ -45,7 +45,7 @@ You can create a log file specific for the connections by specifying:

-connection-log: somefile.txt

This file will contain the detailed trace output
This file will contain the detailed trace output. The file given is relative to the working directory.

## Syntax

Expand Down

0 comments on commit ebec1d6

Please sign in to comment.