You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/12/16 00:35:05 UTC
[GitHub] [lucene] mocobeta commented on a change in pull request #544: LUCENE-10313: drop log4j from luke
mocobeta commented on a change in pull request #544:
URL: https://github.com/apache/lucene/pull/544#discussion_r770140180
##########
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 INFO level is fine for users.
```suggestion
circularBuffer.setLevel(Level.INFO);
```
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org