package com.westudio.java.util;

import sun.misc.Signal;
import sun.misc.SignalHandler;

import java.util.concurrent.atomic.AtomicBoolean;

public class Conf {

    public static boolean handleShutdown(Class<?> clazz, String[] args,
        final AtomicBoolean running) {
        if (args != null && args.length > 0 && args[0].equals("stop")) {
            running.set(false);
            return true;
        }

        SignalHandler handler = new SignalHandler() {
            @Override
            public void handle(Signal signal) {

            }
        };

        String command = System.getProperty("sun.java.command");
        if (command == null || command.isEmpty()) {
            return false;
        }

        if (clazz.getName().equals(command.split(" ")[0])) {
            Signal.handle(new Signal("INT"), handler);
            Signal.handle(new Signal("TERM"), handler);
        }

        return false;
    }
}

@@ -131,16 +131,161 @@
 Boolean;
+%0Aimport java.util.logging.FileHandler;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0Aimport java.util.logging.SimpleFormatter;
 %0A%0Apublic
@@ -1066,11 +1066,413 @@
 e;%0A    %7D
+%0A%0A    public static Logger openLogger(String name, int limit, int count) %7B%0A        Logger logger = Logger.getAnonymousLogger();%0A        logger.setLevel(Level.INFO);%0A        logger.setUseParentHandlers(false);%0A%0A        FileHandler handler = null;%0A%0A        handler.setLevel(Level.INFO);%0A        handler.setFormatter(new SimpleFormatter());%0A        logger.addHandler(handler);%0A        return logger;%0A    %7D
 %0A%7D%0A

use java logger instead....