Skip to content

Commit

Permalink
retain logger instance to actually log things
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke committed Apr 21, 2016
1 parent b26ad3e commit 5cf91cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions okcurl/src/main/java/okhttp3/curl/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
public class Main extends HelpOption implements Runnable {
static final String NAME = "okcurl";
static final int DEFAULT_TIMEOUT = -1;
private static Logger frameLogger;

static Main fromArgs(String... args) {
return SingleCommand.singleCommand(Main.class).parse(args);
Expand Down Expand Up @@ -270,15 +271,15 @@ private static HostnameVerifier createInsecureHostnameVerifier() {
}

private static void enableHttp2FrameLogging() {
Logger logger = Logger.getLogger(Http2.class.getName() + "$FrameLogger");
logger.setLevel(Level.FINE);
frameLogger = Logger.getLogger(Http2.class.getName() + "$FrameLogger");
frameLogger.setLevel(Level.FINE);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.FINE);
handler.setFormatter(new SimpleFormatter() {
@Override public String format(LogRecord record) {
return String.format("%s%n", record.getMessage());
}
});
logger.addHandler(handler);
frameLogger.addHandler(handler);
}
}

0 comments on commit 5cf91cf

Please sign in to comment.