Skip to content

Commit

Permalink
Merge pull request square#2496 from yschimke/retain_frame_logger
Browse files Browse the repository at this point in the history
retain logger instance to actually log things
  • Loading branch information
swankjesse committed Apr 21, 2016
2 parents 14cb6e3 + 5cf91cf commit ba54110
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 ba54110

Please sign in to comment.