SystemLog: Don't keep Config as a member

The instance is only used in the createAsyncAppender method to get the
value of core.asyncLoggingBufferSize.

Replace the Config instance with an int that is initialized in the
constructor.

Change-Id: I5528b4dc2b3e508cbac988cb7b5464cc2662a121
This commit is contained in:
David Pursehouse
2017-11-21 21:47:59 +09:00
parent 2281fefeae
commit 4310ae0d24

View File

@@ -43,12 +43,12 @@ public class SystemLog {
public static final String LOG4J_CONFIGURATION = "log4j.configuration"; public static final String LOG4J_CONFIGURATION = "log4j.configuration";
private final SitePaths site; private final SitePaths site;
private final Config config; private final int asyncLoggingBufferSize;
@Inject @Inject
public SystemLog(SitePaths site, @GerritServerConfig Config config) { public SystemLog(SitePaths site, @GerritServerConfig Config config) {
this.site = site; this.site = site;
this.config = config; this.asyncLoggingBufferSize = config.getInt("core", "asyncLoggingBufferSize", 64);
} }
public static boolean shouldConfigure() { public static boolean shouldConfigure() {
@@ -73,7 +73,7 @@ public class SystemLog {
AsyncAppender async = new AsyncAppender(); AsyncAppender async = new AsyncAppender();
async.setName(name); async.setName(name);
async.setBlocking(true); async.setBlocking(true);
async.setBufferSize(config.getInt("core", "asyncLoggingBufferSize", 64)); async.setBufferSize(asyncLoggingBufferSize);
async.setLocationInfo(false); async.setLocationInfo(false);
if (shouldConfigure()) { if (shouldConfigure()) {