java类org.apache.log4j.ConsoleAppender的实例源码

SPLGroungControlTest.java 文件源码 项目:SPLGroundControl 阅读 20 收藏 0 点赞 0 评论 0
@BeforeClass
public static void setUpClass() throws Exception {
    //Configure log4j
    ConsoleAppender console = new ConsoleAppender(); 
    String PATTERN = "%d [%p|%c|%C{1}] %m%n";
    console.setLayout(new PatternLayout(PATTERN)); 
    console.setThreshold(Level.DEBUG);
    console.activateOptions();

    Logger.getRootLogger().addAppender(console);

    System.out.println("SETUP: Starting SPLGroundControl...");
    config.init(args);

    daemon.init(new SPLGroundControl.SPLDaemonContext(args));
    daemon.start();
}
EndPointHealthServiceImpl.java 文件源码 项目:endpoint-health 阅读 22 收藏 0 点赞 0 评论 0
private void setupLogging() {
    LogManager.getLogManager().reset();
    Logger.getRootLogger().getLoggerRepository().resetConfiguration();

    final Logger rootLogger = Logger.getRootLogger();
    final PatternLayout layout = new PatternLayout("%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n");
    final Level level = endPointHealthConfiguration.logLevel();

    final ConsoleAppender consoleAppender = new ConsoleAppender(layout, ConsoleAppender.SYSTEM_ERR);

    consoleAppender.setThreshold(level);
    consoleAppender.activateOptions();

    final FileAppender fileAppender = new FileAppender();

    fileAppender.setFile(endPointHealthConfiguration.logFile().getAbsolutePath());
    fileAppender.setLayout(layout);
    fileAppender.setThreshold(level);
    fileAppender.setAppend(true);
    fileAppender.setErrorHandler(new FallbackAppenderErrorHandler(rootLogger, fileAppender, consoleAppender));

    rootLogger.addAppender(fileAppender);

    fileAppender.activateOptions();
}
DeadSocketTlsTest.java 文件源码 项目:LightSIP 阅读 21 收藏 0 点赞 0 评论 0
public void setUp() {

        Logger root = Logger.getRootLogger();
        root.setLevel(Level.DEBUG);
        root.addAppender(new ConsoleAppender(
                new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)));
        // setup TLS properties
        System.setProperty( "javax.net.ssl.keyStore",  TlsTest.class.getResource("testkeys").getPath() );
        System.setProperty( "javax.net.ssl.trustStore", TlsTest.class.getResource("testkeys").getPath() );
        System.setProperty( "javax.net.ssl.keyStorePassword", "passphrase" );
        System.setProperty( "javax.net.ssl.keyStoreType", "jks" );
        this.shootist = new BadShootist();
        this.shootme = new BadShootme();
        shootist.setSocketDisconnectWorstCase(true);
        shootme.setSocketDisconnectWorstCase(true);
        this.shootme.init();
    }
MarkLogicMonitor.java 文件源码 项目:marklogic-monitoring-extension 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws TaskExecutionException {

        ConsoleAppender ca = new ConsoleAppender();
        ca.setWriter(new OutputStreamWriter(System.out));
        ca.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
        ca.setThreshold(Level.TRACE);

        logger.getRootLogger().addAppender(ca);

        final MarkLogicMonitor monitor = new MarkLogicMonitor();

        final Map<String, String> taskArgs = new HashMap<String, String>();
        taskArgs.put("config-file", "src/main/resources/conf/config.yml");
        taskArgs.put("metrics-file", "src/main/resources/conf/metrics.xml");
        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
        scheduler.scheduleAtFixedRate(new Runnable() {
            public void run() {
                try {
                    monitor.execute(taskArgs, null);
                } catch (Exception e) {
                    logger.error("Error while running the task", e);
                }
            }
        }, 2, 30, TimeUnit.SECONDS);
    }
iBenchDriver.java 文件源码 项目:ibench 阅读 35 收藏 0 点赞 0 评论 0
private static void setUpConfigLogger(File pathF, String configName) throws IOException {
    Logger.getRootLogger().removeAllAppenders();

    String nameSuffix = configName.replace(".txt", "");

    PropertyConfigurator.configure("resource/log4jproperties.txt"); 

    FileAppender logFileAppender = new FileAppender(
            new PatternLayout("%-4r [%t] %-5p %c %x - %m%n"),
            new File(pathF, "log_" + nameSuffix + ".txt").toString(), false);
    Logger.getRootLogger().addAppender(logFileAppender);

    if (opt.logToConsole)
        Logger.getRootLogger().addAppender(new ConsoleAppender(
                new PatternLayout("%-4r [%t] %-5p %c %x - %m%n")));
}
StressTest.java 文件源码 项目:MLE5109-Course-samples 阅读 24 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    Logger.getRootLogger().addAppender(new ConsoleAppender(new PatternLayout("%d{MM-dd HH:mm:ss,SSS} [%t] %5p: %m%n")));
    Logger.getRootLogger().setLevel(Level.DEBUG);

    final RecoveryMessage recoveryMessage = new RecoveryMessage("GROUP1~1~ADD~data1");
    final RecoveryMessage recoveryMessage2 = new RecoveryMessage("GROUP1~1~ADD~data1");

    Service service = new Service(Arrays.asList("GROUP1", "GROUP2"), 10);
    service.process(recoveryMessage);

    ExecutorService executorService = Executors.newSingleThreadExecutor();
    executorService.execute(() -> {
        IntStream.rangeClosed(0, 5000)
                .mapToObj(count -> new RecoveryMessage("GROUP1~" + count + "~ADD~data2"))
                .forEach(service::process);
        Logger.getRootLogger().info("Recovery done");
    });

    service.process(recoveryMessage2);
    service.start();

    executorService.shutdown();
    Utils.simulateWork(TimeUnit.SECONDS.toMillis(2));
}
Printer.java 文件源码 项目:DBTestCompare 阅读 36 收藏 0 点赞 0 评论 0
public static void init(CmpSqlResultsConfig cmpSqlResultsConfig) {
    log.debug("Initializing logger / printer ...");
    ConsoleAppender consoleAppender = (ConsoleAppender) Logger.getRootLogger().getAppender("stdout");
    if (cmpSqlResultsConfig.getLogger() != null && cmpSqlResultsConfig.getLogger().getLogLevel() !=
            null && !cmpSqlResultsConfig.getLogger().getLogLevel().isEmpty()) {
        Logger.getRootLogger().setLevel(Level.toLevel(cmpSqlResultsConfig.getLogger().getLogLevel()));
    }
    if (cmpSqlResultsConfig.getLogger().isTeamcityLogsEnabled()) {
        consoleAppender.setLayout(new PatternLayout("%m%n"));
    }
    consoleAppender.addFilter(new Filter() {
        @Override
        public int decide(LoggingEvent loggingEvent) {
            if(loggingEvent.getMessage() instanceof String == false) return ACCEPT;
            boolean isTCMsg = ((String) loggingEvent.getMessage()).contains(TCMessages.TC);
            // before threads (and buffering messages for TC) we allowed "common" logs
            // boolean isNotTCMsg = ((String) loggingEvent.getMessage()).contains(TCMessages.NOT_TC);
            if (cmpSqlResultsConfig.getLogger().isTeamcityLogsEnabled()) {
                return isTCMsg ? ACCEPT : DENY;
                // return isNotTCMsg ? DENY : ACCEPT;
            } else {
                return isTCMsg ? DENY : ACCEPT;
            }
        }
    });
}
SeedboxSync.java 文件源码 项目:SeedboxSync 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Configures the logger.
 */
private static void configureLogging() {
    PatternLayout layout = new PatternLayout("%d{yyyy-MM-dd' 'HH:mm:ss.SSS} [%-5p] [%c] - %m%n");

    ConsoleAppender console = new ConsoleAppender();
    console.setLayout(layout);
    console.setThreshold(Level.INFO);
    console.activateOptions();

    DailyRollingFileAppender file = new DailyRollingFileAppender();
    file.setFile("log/app.log");
    file.setDatePattern("'.'yyyy-MM-dd");
    file.setLayout(layout);
    file.activateOptions();

    org.apache.log4j.Logger logger = org.apache.log4j.Logger.getRootLogger();
    logger.addAppender(console);
    logger.addAppender(file);
}
ZFXConf.java 文件源码 项目:zoofx 阅读 22 收藏 0 点赞 0 评论 0
public static void addAppender() {
    FileAppender fa = new FileAppender();
    fa.setName("FileLogger");
    String logFile = getConfHome() + System.getProperty("file.separator") + "zoofx.log";
    fa.setFile(logFile);

    Enumeration<Appender> allAppenders = Logger.getRootLogger().getAllAppenders();
    if(allAppenders.hasMoreElements()){
        Appender appender = allAppenders.nextElement();
        if(appender instanceof ConsoleAppender){
            ConsoleAppender ca = (ConsoleAppender)appender;
            fa.setLayout(ca.getLayout());
            fa.setThreshold(ca.getThreshold());
        }
        fa.setAppend(true);
    }
    fa.activateOptions();

    Logger.getRootLogger().addAppender(fa);
}
TestUtil.java 文件源码 项目:Vitruv 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Initializes console logger for tests. Sets the logger level to
 * {@link Level#ERROR} by default. If the VM property <i>logOutputLevel</i>
 * is specified, it is used to determine the logger level.
 */
public static void initializeLogger() {
    Logger.getRootLogger().setLevel(Level.ERROR);
    Logger.getRootLogger().removeAllAppenders();
    Logger.getRootLogger()
            .addAppender(new ConsoleAppender(new PatternLayout("[%-5p] %d{HH:mm:ss,SSS} %-30C{1} - %m%n")));
    String outputLevelProperty = System.getProperty(VM_ARGUMENT_LOG_OUTPUT_LEVEL);
    if (outputLevelProperty != null) {
        if (!Logger.getRootLogger().getAllAppenders().hasMoreElements()) {
            Logger.getRootLogger().addAppender(new ConsoleAppender());
        }
        Logger.getRootLogger().setLevel(Level.toLevel(outputLevelProperty));
    } else {
        Logger.getRootLogger().setLevel(Level.ERROR);
    }
}
ClientConnectorBeanWIKIHom.java 文件源码 项目:CloudCryptoSearch 阅读 20 收藏 0 点赞 0 评论 0
public static void main (String[] args) {
        log.addAppender(new ConsoleAppender(new PatternLayout("%d{ABSOLUTE} %-5p [%c{1}] %m%n")));
        log.setLevel(Level.INFO);
        ClientConnectorLocal client = new ClientConnectorBeanWIKIHom();

        log.info("Setup done. Building index...");
//      client.addFirstDocuments("/home/bernardo/Desktop/enwiki-latest-pages-articles.xml");
//      client.addFirstDocuments("/home/bernardo/Desktop/ptwiki-20121027-pages-articles.xml");
//      client.addFirstDocuments("/home/bernardo/Desktop/eswiki-20121018-pages-articles.xml");
//      log.info("Index Finished!");
        client.rebuildIndex();
        log.info("Starting query...");
        query(client, "IETF payload optimize retransmit threshold RFC protocol  trusted network address");
//      query(client, "IETF payload optimize retransmit threshold");
//      query(client, "IETF payload");
        log.info("Query finished!");
    }
PrototypeClientConnector.java 文件源码 项目:CloudCryptoSearch 阅读 19 收藏 0 点赞 0 评论 0
public static void main (String[] args) throws Exception{
        log.addAppender(new ConsoleAppender(new PatternLayout("%d{ABSOLUTE} %-5p [%c{1}] %m%n")));
        log.setLevel(Level.INFO);
        PrototypeClientConnector client = new PrototypeClientConnector();

        log.info("Setup done. Building index...");
        File f = new File("/Users/bernardo/Dropbox/WorkspacePHD/CryptoSearchCloud/docs");
        client.addFirstDocuments(f.listFiles());
        log.info("Index Finished!");
        client.rebuildIndex();
        log.info("Starting query...");
//      query(client, "IETF payload optimize retransmit threshold RFC protocol  trusted network address");
//      query(client, "IETF payload optimize retransmit threshold");
//      query(client, "IETF payload");
        query(client, "rTp");
        log.info("Query finished!");
    }
ClientConnectorBeanWIKI.java 文件源码 项目:CloudCryptoSearch 阅读 23 收藏 0 点赞 0 评论 0
public static void main (String[] args) {
        log.addAppender(new ConsoleAppender(new PatternLayout("%d{ABSOLUTE} %-5p [%c{1}] %m%n")));
        log.setLevel(Level.INFO);
        ClientConnectorLocal client = new ClientConnectorBeanWIKI();

        log.info("Setup done. Building index...");
//      client.addFirstDocuments("/home/bernardo/Desktop/enwiki-latest-pages-articles.xml");
//      client.addFirstDocuments("/home/bernardo/Desktop/ptwiki-20121027-pages-articles.xml");
//      client.addFirstDocuments("/home/bernardo/Desktop/eswiki-20121018-pages-articles.xml");
//      log.info("Index Finished!");
        client.rebuildIndex();
        log.info("Starting query...");
        query(client, "IETF payload optimize retransmit threshold RFC protocol  trusted network address");
//      query(client, "IETF payload optimize retransmit threshold");
//      query(client, "IETF payload");
        log.info("Query finished!");
    }
TransportParser.java 文件源码 项目:VirtaMarketAnalyzer 阅读 20 收藏 0 点赞 0 评论 0
public static void main(final String[] args) throws IOException {
    BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%r %d{ISO8601} [%t] %p %c %x - %m%n")));
    final String host = Wizard.host;
    final String realm = "olga";
    logger.info("begin");
    final List<Country> countries = CityInitParser.getCountries(host, realm);
    logger.info("countries.size = {}", countries.size());
    final List<Region> regions = CityInitParser.getRegions(host, realm);
    logger.info("regions.size = {}", regions.size());
    final List<City> cities = CityListParser.fillWealthIndex(host, realm, regions);
    logger.info("cities.size = {}", cities.size());
    final List<Product> materials = ProductInitParser.getManufactureProducts(host, realm);
    logger.info("materials.size = {}", materials.size());
    logger.info("парсим транспортные расходы, {}", materials.size() * cities.size());

    TransportParser.setRowsOnPage(host, realm, Math.max(400, cities.size()), cities.get(0), materials.get(0));
    final List<Transport> list = TransportParser.parseTransport(host, realm, cities, cities.get(0), materials.get(0));
    logger.info(Utils.getPrettyGson(list));
    logger.info("list.size = {}", list.size());
}
ProductRecipeParser.java 文件源码 项目:VirtaMarketAnalyzer 阅读 18 收藏 0 点赞 0 评论 0
public static void main(final String[] args) throws IOException {
        BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%r %d{ISO8601} [%t] %p %c %x - %m%n")));
//        final Document doc = Downloader.getDoc(Wizard.host + "olga/main/industry/unit_type/info/15751");
//        final Document doc = Downloader.getDoc(Wizard.host + "olga/main/industry/unit_type/info/422209");
//        final Document doc = Downloader.getDoc(Wizard.host + "olga/main/industry/unit_type/info/2425");
//        final Document doc = Downloader.getDoc(Wizard.host + "olga/main/industry/unit_type/info/2417");
        final String host = Wizard.host;
        final String realm = "olga";
        final String url = host + realm + "/main/industry/unit_type/info/";
        final List<Manufacture> manufactures = new ArrayList<>();
//        manufactures.add(new Manufacture("423140", "manufactureCategory", "caption"));
//        manufactures.add(new Manufacture("2425", "manufactureCategory", "caption"));
        manufactures.add(new Manufacture("2438", "manufactureCategory", "caption", new ArrayList<>()));

        final Map<String, List<ProductRecipe>> result = getProductRecipes(host, realm, manufactures);
        logger.info(Utils.getPrettyGson(result));
    }
TechMarketAskParser.java 文件源码 项目:VirtaMarketAnalyzer 阅读 24 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws IOException {
        BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%r %d{ISO8601} [%t] %p %c %x - %m%n")));

        final String realm = "olga";
        final List<TechLicenseLvl> askWoBidTechLvl = getLicenseAskWoBid(Wizard.host, realm);
//        logger.info(Utils.getPrettyGson(askWoBidTechLvl));
        for (final TechLicenseLvl tl : askWoBidTechLvl) {
            //https://virtonomica.ru/olga/main/globalreport/technology/2423/10/target_market_summary/21-03-2016/ask
            if (tl.getTechId().equals("2423") && tl.getLvl() == 10) {
                logger.info(Utils.getPrettyGson(tl));
            }
            //https://virtonomica.ru/olga/main/globalreport/technology/423140/2/target_market_summary/21-03-2016/ask
            if (tl.getTechId().equals("423140") && tl.getLvl() == 2) {
                logger.info(Utils.getPrettyGson(tl));
            }
            //https://virtonomica.ru/olga/main/globalreport/technology/1906/7/target_market_summary/21-03-2016/ask
            if (tl.getTechId().equals("1906") && tl.getLvl() == 7) {
                logger.info(Utils.getPrettyGson(tl));
            }
            break;
        }
        logger.info("askWoBidTechLvl.size() = {}", askWoBidTechLvl.size());
        final List<TechUnitType> techList = TechListParser.getTechUnitTypes(Wizard.host, realm);
        logger.info("techList.size() = {}", techList.size());
        System.out.println(Utils.getPrettyGson(getTech(Wizard.host, realm, techList)));
    }
ShopParser.java 文件源码 项目:VirtaMarketAnalyzer 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
        BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%r %d{ISO8601} [%t] %p %c %x - %m%n")));
//        final String url = Wizard.host + "olga/main/unit/view/5788675";
        final String host = Wizard.host;
//        final String realm = "mary";
//        final String url = host + realm + "/main/unit/view/3943258";
        final String realm = "olga";
        final String url = host + realm + "/main/unit/view/6519771";
//        Downloader.invalidateCache(url);
        final List<City> cities = new ArrayList<>();
        cities.add(new City("422653", "422655", "422682", "Вашингтон", 0.0, 0.0, 0.0, 0,0, null));
        final List<Product> products = new ArrayList<>();
        products.add(ProductInitParser.getTradingProduct(host, realm, "422547"));
        products.add(ProductInitParser.getTradingProduct(host, realm, "3838"));
        final Map<String, List<Product>> productsByImgSrc = products.stream().collect(Collectors.groupingBy(Product::getImgUrl));
        System.out.println(Utils.getPrettyGson(parse(realm, url, cities, productsByImgSrc, "Вашингтон")));
    }
KafkaMonitor.java 文件源码 项目:kafka-monitoring-extension 阅读 22 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws TaskExecutionException {

        ConsoleAppender ca = new ConsoleAppender();
        ca.setWriter(new OutputStreamWriter(System.out));
        ca.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
        ca.setThreshold(Level.DEBUG);
        logger.getRootLogger().addAppender(ca);

        final Map<String, String> taskArgs = new HashMap<String, String>();
        taskArgs.put(CONFIG_ARG, "/Users/Muddam/AppDynamics/Code/extensions/kafka-monitoring-extension/src/main/resources/config/config.yml");

        final KafkaMonitor monitor = new KafkaMonitor();
        //monitor.execute(taskArgs, null);

        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
        scheduler.scheduleAtFixedRate(new Runnable() {
            public void run() {
                try {
                    monitor.execute(taskArgs, null);
                } catch (Exception e) {
                    logger.error("Error while running the Task ", e);
                }
            }
        }, 2, 60, TimeUnit.SECONDS);
    }
FileReporterListener.java 文件源码 项目:eurocarbdb 阅读 25 收藏 0 点赞 0 评论 0
/** 
*   Constructor; also redirects log4j output to System.out, 
*   which is itself re-directed on a per-test-class basis as described 
*   in class description.
*/
public FileReporterListener()
{       
    setupLogging();

    //  configure log4j to write to STDOUT, which we will re-direct on 
    //  a per-test basis
    //
    ConsoleAppender logOutput 
        = new ConsoleAppender( 
            new PatternLayout("%5p: %m (%l)%n"), 
                "System.out" ); 

    logOutput.setImmediateFlush( true );
    logOutput.setFollow( true );
    logOutput.activateOptions();

    Logger root = Logger.getRootLogger();

    root.removeAllAppenders();

    root.addAppender( logOutput );        
}
Log4jUtilsTest.java 文件源码 项目:commons-dost 阅读 21 收藏 0 点赞 0 评论 0
@Test
public void testRolloverLogfile() throws Exception {
    Log4jUtils.rolloverLogfile();

    // add appender to cover more
    Logger.getLogger("somelogger");
    Logger.getRootLogger().addAppender(new ConsoleAppender());
    final RollingFileAppender rollingFileAppender = new RollingFileAppender();
    File file = File.createTempFile("log4j", ".log");
    rollingFileAppender.setFile(file.getAbsolutePath());
    Logger.getRootLogger().addAppender(rollingFileAppender);

    Log4jUtils.rolloverLogfile();

    file.deleteOnExit();
    new File(file.getAbsoluteFile() + ".1").deleteOnExit();
}
DSWorkbenchWatchtowerFrame.java 文件源码 项目:dsworkbench 阅读 19 收藏 0 点赞 0 评论 0
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
    try {
        //  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (Exception ignored) {
    }
    DSWorkbenchWatchtowerFrame.getSingleton().resetView();
    for (int i = 0; i < 50; i++) {
        KnownVillageManager.getSingleton().addWatchtowerLevel(new DummyVillage((short) i, (short) i), 2);
    }

    DSWorkbenchWatchtowerFrame.getSingleton().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    DSWorkbenchWatchtowerFrame.getSingleton().setVisible(true);

}
DSWorkbenchStatsFrame.java 文件源码 项目:dsworkbench 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String args[]) {

    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
    try {
        //  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        //  UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
    } catch (Exception e) {
        e.printStackTrace();
    }
    GlobalOptions.setSelectedServer("de68");
    DataHolder.getSingleton().loadData(false);
    StatManager.getSingleton().setup();

    DSWorkbenchStatsFrame.getSingleton().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    DSWorkbenchStatsFrame.getSingleton().resetView();
    DSWorkbenchStatsFrame.getSingleton().setVisible(true);

}
DSWorkbenchDistanceFrame.java 文件源码 项目:dsworkbench 阅读 16 收藏 0 点赞 0 评论 0
public static void main(String args[]) {
    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));

    GlobalOptions.setSelectedServer("de43");
    DataHolder.getSingleton().loadData(false);
    ProfileManager.getSingleton().loadProfiles();

    GlobalOptions.setSelectedProfile(ProfileManager.getSingleton().getProfiles("de43")[0]);
    try {
        //  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (Exception ignored) {
    }
    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));

    for (int i = 0; i < 10; i++) {
        DistanceManager.getSingleton().addVillage(GlobalOptions.getSelectedProfile().getTribe().getVillageList()[i]);
    }
    DSWorkbenchDistanceFrame.getSingleton().resetView(true);
    DSWorkbenchDistanceFrame.getSingleton().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    DSWorkbenchDistanceFrame.getSingleton().setVisible(true);

}
DSWorkbenchChurchFrame.java 文件源码 项目:dsworkbench 阅读 19 收藏 0 点赞 0 评论 0
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
    try {
        //  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (Exception ignored) {
    }
    DSWorkbenchChurchFrame.getSingleton().resetView();
    for (int i = 0; i < 50; i++) {
        KnownVillageManager.getSingleton().addChurchLevel(new DummyVillage((short) i, (short) i), 2);
    }

    DSWorkbenchChurchFrame.getSingleton().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    DSWorkbenchChurchFrame.getSingleton().setVisible(true);

}
DSWorkbenchSelectionFrame.java 文件源码 项目:dsworkbench 阅读 18 收藏 0 点赞 0 评论 0
public static void main(String[] args) {

        Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
        GlobalOptions.setSelectedServer("de43");
        GlobalOptions.setSelectedProfile(new DummyProfile());
        DataHolder.getSingleton().loadData(false);
        try {
            //  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception ignored) {
        }
        List<Village> selection = new LinkedList<>();
        for (int i = 0; i < 100; i++) {
            selection.add(DataHolder.getSingleton().getRandomVillage());
        }

        DSWorkbenchSelectionFrame.getSingleton().resetView();
        DSWorkbenchSelectionFrame.getSingleton().addVillages(selection);

        DSWorkbenchSelectionFrame.getSingleton().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        DSWorkbenchSelectionFrame.getSingleton().setVisible(true);

    }
DSWorkbenchFormFrame.java 文件源码 项目:dsworkbench 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    try {
        //  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (Exception ignored) {
    }
    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
    DSWorkbenchFormFrame.getSingleton().setSize(800, 600);
    FormManager.getSingleton().addForm(new Circle());
    FormManager.getSingleton().addForm(new de.tor.tribes.types.drawing.Rectangle());
    FormManager.getSingleton().addForm(new Circle());
    FormManager.getSingleton().addForm(new de.tor.tribes.types.drawing.Rectangle());
    FormManager.getSingleton().addForm(new Circle());
    FormManager.getSingleton().addForm(new de.tor.tribes.types.drawing.Rectangle());
    FormManager.getSingleton().addForm(new Circle());
    FormManager.getSingleton().addForm(new de.tor.tribes.types.drawing.Rectangle());
    FormManager.getSingleton().addForm(new Line());

    DSWorkbenchFormFrame.getSingleton().resetView();
    DSWorkbenchFormFrame.getSingleton().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    DSWorkbenchFormFrame.getSingleton().setVisible(true);
}
ErrorLogFile.java 文件源码 项目:gerrit 阅读 17 收藏 0 点赞 0 评论 0
public static void errorOnlyConsole() {
  LogManager.resetConfiguration();

  final PatternLayout layout = new PatternLayout();
  layout.setConversionPattern("%-5p %c %x: %m%n");

  final ConsoleAppender dst = new ConsoleAppender();
  dst.setLayout(layout);
  dst.setTarget("System.err");
  dst.setThreshold(Level.ERROR);
  dst.activateOptions();

  final Logger root = LogManager.getRootLogger();
  root.removeAllAppenders();
  root.addAppender(dst);
}
TacticsPlanerWizard.java 文件源码 项目:dsworkbench 阅读 21 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    try {
        // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (Exception ignored) {
    }


    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
    GlobalOptions.setSelectedServer("de38");
    ProfileManager.getSingleton().loadProfiles();
    GlobalOptions.setSelectedProfile(ProfileManager.getSingleton().getProfiles("de38")[1]);
    DataHolder.getSingleton().loadData(false);
    GlobalOptions.loadUserData();

    TacticsPlanerWizard to = new TacticsPlanerWizard();
    to.restoreProperties();
    to.show();
    //Wizard wizard = provider.createWizard();
    //   System.out.println(WizardDisplayer.showWizard(wizard));
}
TroopFilterDialog.java 文件源码 项目:dsworkbench 阅读 21 收藏 0 点赞 0 评论 0
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
    GlobalOptions.setSelectedServer("de43");
    ProfileManager.getSingleton().loadProfiles();
    GlobalOptions.setSelectedProfile(ProfileManager.getSingleton().getProfiles("de43")[0]);
    DataHolder.getSingleton().loadData(false);

    final TroopFilterDialog dialog = new TroopFilterDialog(null, false);
    dialog.reset();
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
            dialog.show(new LinkedList<Village>());
        }
    });
}
TroopSelectionPanel.java 文件源码 项目:dsworkbench 阅读 23 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    Logger.getRootLogger().addAppender(new ConsoleAppender(new org.apache.log4j.PatternLayout("%d - %-5p - %-20c (%C [%L]) - %m%n")));
    GlobalOptions.setSelectedServer("de77");
    ProfileManager.getSingleton().loadProfiles();
    GlobalOptions.setSelectedProfile(ProfileManager.getSingleton().getProfiles("de77")[0]);
    DataHolder.getSingleton().loadData(false);
    GlobalOptions.loadUserData();

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.setSize(300, 300);
    TroopSelectionPanelFixed panel = new TroopSelectionPanelFixed();
    panel.setupDefense(false);
    f.getContentPane().add(panel);
    f.pack();
    f.setVisible(true);
}


问题


面经


文章

微信
公众号

扫码关注公众号