init: Do not setup the GC logger
This breaks the rest of the log4j system and causes spurious errors when setting up SSH keys during initial site creation. GC won't run in init. Even if it did the console setup is covered by the root logger in ErrorLogFile. Change-Id: Iaa2f4dc4248fc289910c2401a6e8e2dd3eacc712
This commit is contained in:
parent
8281c7e865
commit
96059099ed
@ -26,7 +26,6 @@ import com.google.gerrit.pgm.init.SitePathInitializer;
|
||||
import com.google.gerrit.pgm.util.ConsoleUI;
|
||||
import com.google.gerrit.pgm.util.Die;
|
||||
import com.google.gerrit.pgm.util.ErrorLogFile;
|
||||
import com.google.gerrit.pgm.util.GarbageCollectionLogFile;
|
||||
import com.google.gerrit.pgm.util.IoUtil;
|
||||
import com.google.gerrit.pgm.util.SiteProgram;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
@ -67,7 +66,6 @@ public class Init extends SiteProgram {
|
||||
@Override
|
||||
public int run() throws Exception {
|
||||
ErrorLogFile.errorOnlyConsole();
|
||||
GarbageCollectionLogFile.errorOnlyConsole();
|
||||
|
||||
final SiteInit init = createSiteInit();
|
||||
init.flags.autoStart = !noAutoStart && init.site.isNew;
|
||||
|
@ -19,7 +19,6 @@ import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.gerrit.server.git.GarbageCollection;
|
||||
|
||||
import org.apache.log4j.Appender;
|
||||
import org.apache.log4j.ConsoleAppender;
|
||||
import org.apache.log4j.DailyRollingFileAppender;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.LogManager;
|
||||
@ -37,22 +36,6 @@ import java.io.IOException;
|
||||
public class GarbageCollectionLogFile {
|
||||
private static final org.slf4j.Logger log = LoggerFactory.getLogger(GarbageCollectionLogFile.class);
|
||||
|
||||
public static void errorOnlyConsole() {
|
||||
LogManager.resetConfiguration();
|
||||
|
||||
PatternLayout layout = new PatternLayout();
|
||||
layout.setConversionPattern("%-5p %x: %m%n");
|
||||
|
||||
ConsoleAppender dst = new ConsoleAppender();
|
||||
dst.setLayout(layout);
|
||||
dst.setTarget("System.err");
|
||||
dst.setThreshold(Level.ERROR);
|
||||
|
||||
Logger root = LogManager.getLogger(GarbageCollection.LOG_NAME);
|
||||
root.removeAllAppenders();
|
||||
root.addAppender(dst);
|
||||
}
|
||||
|
||||
public static LifecycleListener start(File sitePath)
|
||||
throws FileNotFoundException {
|
||||
File logdir = new SitePaths(sitePath).logs_dir;
|
||||
|
Loading…
Reference in New Issue
Block a user