dweiss commented on a change in pull request #544:
URL: https://github.com/apache/lucene/pull/544#discussion_r770362622
##########
File path: lucene/luke/src/java/org/apache/lucene/luke/util/LoggerFactory.java
##########
@@ -17,54 +17,28 @@
package org.apache.lucene.luke.util;
-import java.nio.charset.StandardCharsets;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.appender.FileAppender;
-import org.apache.logging.log4j.core.config.Configurator;
-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 org.apache.logging.log4j.core.layout.PatternLayout;
-import org.apache.lucene.luke.app.desktop.util.TextAreaAppender;
+import java.util.logging.Level;
+import java.util.logging.Logger;
-/** Logger factory. This programmatically configurates logger context
(Appenders etc.) */
+/** Logger factory. This configures log interceptors for the GUI. */
public class LoggerFactory {
+ public static CircularLogBufferHandler circularBuffer;
- public static void initGuiLogging(String logFile) {
- ConfigurationBuilder<BuiltConfiguration> builder =
- ConfigurationBuilderFactory.newConfigurationBuilder();
- builder.add(builder.newRootLogger(Level.INFO));
- LoggerContext context = Configurator.initialize(builder.build());
+ public static void initGuiLogging() {
+ if (circularBuffer != null) {
+ throw new RuntimeException("Double-initialization?");
+ }
- PatternLayout layout =
- PatternLayout.newBuilder()
- .withPattern("[%d{ISO8601}] %5p (%F:%L) - %m%n")
- .withCharset(StandardCharsets.UTF_8)
- .build();
+ circularBuffer = new CircularLogBufferHandler();
+ circularBuffer.setLevel(Level.FINEST);
Review comment:
I think all the logs may be useful sometimes so I left the level as it
was but added a combo box filter so that you can select the level you want to
see the logs displayed at. I also moved the logging tracking/ initialization
code to the panel component. It works fine for me.
Give me your thumbs up here and I'll merge it in.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]