<commit_before>package ameba.dev;

import ameba.container.Container;
import ameba.core.Application;
import ameba.event.Listener;
import ameba.feature.AmebaFeature;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.jersey.filter.LoggingFilter;

import javax.inject.Inject;
import javax.ws.rs.core.FeatureContext;

/**
 * @author icode
 */

public class DevFeature extends AmebaFeature {
    @Inject
    private Application app;
    @Inject
    private ServiceLocator locator;

    @Override
    public boolean configure(FeatureContext context) {
        if (app.getMode().isDev()) {
            subscribeEvent(Application.RequestEvent.class, ReloadRequestListener.class);
            if (!app.isInitialized()) {
                subscribeSystemEvent(Container.StartupEvent.class, new Listener<Container.StartupEvent>() {
                    @Override
                    public void onReceive(Container.StartupEvent event) {
                        Thread.currentThread().setContextClassLoader(app.getClassLoader());
                        final ReloadRequestListener listener = locator.createAndInitialize(ReloadRequestListener.class);
                        final ReloadRequestListener.Reload reload = listener.scanChanges();
                        if (reload.needReload && reload.classes != null && reload.classes.size() > 0) {
                            new Thread(new Runnable() {
                                @Override
                                public void run() {
                                    try {
                                        AmebaFeature.publishEvent(new ClassReloadEvent(reload.classes));
                                        listener.reload(reload.classes, ReloadRequestListener._classLoader);
                                    } catch (Throwable e) {
                                        logger().error("编译出错", e);
                                    }
                                }
                            }).start();
                        }

                        unsubscribeSystemEvent(Container.StartupEvent.class, this);
                    }
                });
            }

            if (!context.getConfiguration().isRegistered(LoggingFilter.class)) {
                context.register(LoggingFilter.class);
            }
        }
        return true;
    }
}
<commit_msg>更改日志过滤器<commit_after>package ameba.dev;

import ameba.container.Container;
import ameba.core.Application;
import ameba.event.Listener;
import ameba.feature.AmebaFeature;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.jersey.filter.LoggingFilter;

import javax.inject.Inject;
import javax.ws.rs.core.FeatureContext;
import java.util.logging.Logger;

/**
 * @author icode
 */

public class DevFeature extends AmebaFeature {
    @Inject
    private Application app;
    @Inject
    private ServiceLocator locator;

    @Override
    public boolean configure(FeatureContext context) {
        if (app.getMode().isDev()) {
            subscribeEvent(Application.RequestEvent.class, ReloadRequestListener.class);
            if (!app.isInitialized()) {
                subscribeSystemEvent(Container.StartupEvent.class, new Listener<Container.StartupEvent>() {
                    @Override
                    public void onReceive(Container.StartupEvent event) {
                        Thread.currentThread().setContextClassLoader(app.getClassLoader());
                        final ReloadRequestListener listener = locator.createAndInitialize(ReloadRequestListener.class);
                        final ReloadRequestListener.Reload reload = listener.scanChanges();
                        if (reload.needReload && reload.classes != null && reload.classes.size() > 0) {
                            new Thread(new Runnable() {
                                @Override
                                public void run() {
                                    try {
                                        AmebaFeature.publishEvent(new ClassReloadEvent(reload.classes));
                                        listener.reload(reload.classes, ReloadRequestListener._classLoader);
                                    } catch (Throwable e) {
                                        logger().error("编译出错", e);
                                    }
                                }
                            }).start();
                        }

                        unsubscribeSystemEvent(Container.StartupEvent.class, this);
                    }
                });
            }

            context.register(new LoggingFilter(Logger.getLogger("ameba.dev.logging"), true));
        }
        return true;
    }
}

{'fraction_non_alphanumeric': 0.0871139510117146, 'fraction_numerical': 0.0008519701810436634, 'mean_word_length': 1.539751216873986, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2125265', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1063, 'n_words': 186}