import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.builders.appender.ConsoleAppenderBuilder;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.builder.api.AppenderComponentBuilder;
+import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
+import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
+import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
import jalview.datamodel.PDBEntry;
import jalview.gui.Preferences;
}
try
{
- // TODO: redirect stdout and stderr here in order to grab the output of
- // the log
-
- ConsoleAppender ap = new ConsoleAppender();
- ap.setLayout(new SimpleLayout());
- //ap.setTarget("System.err");
- ap.setName("JalviewLogger");
- org.apache.log4j.Logger.getRootLogger().addAppender(ap); // catch all for
+ // configure the root logger to stderr
+ ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
+ AppenderComponentBuilder consoleApp = builder.newAppender("stderr", "Console");
+ builder.add(consoleApp);
+ Configurator.initialize(builder.build());
// log output
Logger laxis = Logger.getLogger("org.apache.axis");
Logger lcastor = Logger.getLogger("org.exolab.castor");