Search in sources :

Example 86 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project pyramid by cheng-li.

the class Calibration method main.

public static void main(Config config) throws Exception {
    Logger logger = Logger.getAnonymousLogger();
    String logFile = config.getString("output.log");
    FileHandler fileHandler = null;
    if (!logFile.isEmpty()) {
        new File(logFile).getParentFile().mkdirs();
        // todo should append?
        fileHandler = new FileHandler(logFile, true);
        java.util.logging.Formatter formatter = new SimpleFormatter();
        fileHandler.setFormatter(formatter);
        logger.addHandler(fileHandler);
        logger.setUseParentHandlers(false);
    }
    logger.info(config.toString());
    if (config.getBoolean("calibrate")) {
        calibrate(config, logger);
    }
    if (config.getBoolean("test")) {
        test(config, logger);
    }
    if (fileHandler != null) {
        fileHandler.close();
    }
}
Also used : SimpleFormatter(java.util.logging.SimpleFormatter) Logger(java.util.logging.Logger) File(java.io.File) FileHandler(java.util.logging.FileHandler)

Example 87 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project pyramid by cheng-li.

the class AppBRGB method main.

public static void main(String[] args) throws Exception {
    if (args.length != 1) {
        throw new IllegalArgumentException("Please specify a properties file.");
    }
    Config config = new Config(args[0]);
    Logger logger = Logger.getAnonymousLogger();
    String logFile = config.getString("output.log");
    FileHandler fileHandler = null;
    if (!logFile.isEmpty()) {
        new File(logFile).getParentFile().mkdirs();
        // todo should append?
        fileHandler = new FileHandler(logFile, true);
        java.util.logging.Formatter formatter = new SimpleFormatter();
        fileHandler.setFormatter(formatter);
        logger.addHandler(fileHandler);
        logger.setUseParentHandlers(false);
    }
    logger.info(config.toString());
    if (fileHandler != null) {
        fileHandler.close();
    }
    File output = new File(config.getString("output.folder"));
    output.mkdirs();
    Config app1Config = createApp1Config(config);
    Config app2Config = createGBConfig(config);
    Config calConfig = createBRCalibrationConfig(config);
    Config predictConfig = createBRPredictionConfig(config);
    Config autoConfig = createBRAutomationConfig(config);
    App1.main(app1Config);
    BRGB.main(app2Config);
    BRCalibration.main(calConfig);
    BRPrediction.reportValid(predictConfig);
    BRAutomation.tuneThreshold(autoConfig);
    BRPrediction.reportTest(predictConfig);
    BRAutomation.showTestPerformance(autoConfig);
}
Also used : Config(edu.neu.ccs.pyramid.configuration.Config) SimpleFormatter(java.util.logging.SimpleFormatter) Logger(java.util.logging.Logger) File(java.io.File) FileHandler(java.util.logging.FileHandler)

Example 88 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project pyramid by cheng-li.

the class AppCombSUM method main.

public static void main(String[] args) throws Exception {
    if (args.length != 1) {
        throw new IllegalArgumentException("Please specify a properties file.");
    }
    Config config = new Config(args[0]);
    Logger logger = Logger.getAnonymousLogger();
    String logFile = config.getString("output.log");
    FileHandler fileHandler = null;
    if (!logFile.isEmpty()) {
        new File(logFile).getParentFile().mkdirs();
        // todo should append?
        fileHandler = new FileHandler(logFile, true);
        Formatter formatter = new SimpleFormatter();
        fileHandler.setFormatter(formatter);
        logger.addHandler(fileHandler);
        logger.setUseParentHandlers(false);
    }
    logger.info(config.toString());
    File output = new File(config.getString("output.folder"));
    output.mkdirs();
    if (config.getBoolean("calibrate")) {
        calibrate(config, logger);
    }
    if (config.getBoolean("validate")) {
        report(config, config.getString("validFolder"));
    }
    if (config.getBoolean("tuneThreshold")) {
        tuneThreshold(config, logger);
    }
    if (config.getBoolean("test")) {
        report(config, config.getString("testFolder"));
        testAutomation(config, logger);
    }
    if (fileHandler != null) {
        fileHandler.close();
    }
}
Also used : Config(edu.neu.ccs.pyramid.configuration.Config) SimpleFormatter(java.util.logging.SimpleFormatter) Formatter(java.util.logging.Formatter) SimpleFormatter(java.util.logging.SimpleFormatter) Logger(java.util.logging.Logger) File(java.io.File) FileHandler(java.util.logging.FileHandler)

Example 89 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project pyramid by cheng-li.

the class GBRegressor method main.

public static void main(String[] args) throws Exception {
    if (args.length != 1) {
        throw new IllegalArgumentException("Please specify a properties file.");
    }
    Config config = new Config(args[0]);
    Logger logger = Logger.getAnonymousLogger();
    String logFile = config.getString("output.log");
    FileHandler fileHandler = null;
    if (!logFile.isEmpty()) {
        new File(logFile).getParentFile().mkdirs();
        // todo should append?
        fileHandler = new FileHandler(logFile, true);
        java.util.logging.Formatter formatter = new SimpleFormatter();
        fileHandler.setFormatter(formatter);
        logger.addHandler(fileHandler);
        logger.setUseParentHandlers(false);
    }
    logger.info(config.toString());
    if (config.getBoolean("train")) {
        train(config, logger);
    }
    if (config.getBoolean("test")) {
        test(config, logger);
    }
    if (fileHandler != null) {
        fileHandler.close();
    }
}
Also used : RegTreeConfig(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig) Config(edu.neu.ccs.pyramid.configuration.Config) SimpleFormatter(java.util.logging.SimpleFormatter) Logger(java.util.logging.Logger) File(java.io.File) FileHandler(java.util.logging.FileHandler)

Example 90 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project pyramid by cheng-li.

the class GBRegressor method main.

public static void main(Config config) throws Exception {
    Logger logger = Logger.getAnonymousLogger();
    String logFile = config.getString("output.log");
    FileHandler fileHandler = null;
    if (!logFile.isEmpty()) {
        new File(logFile).getParentFile().mkdirs();
        // todo should append?
        fileHandler = new FileHandler(logFile, true);
        java.util.logging.Formatter formatter = new SimpleFormatter();
        fileHandler.setFormatter(formatter);
        logger.addHandler(fileHandler);
        logger.setUseParentHandlers(false);
    }
    logger.info(config.toString());
    if (config.getBoolean("train")) {
        train(config, logger);
    }
    if (config.getBoolean("test")) {
        test(config, logger);
    }
    if (fileHandler != null) {
        fileHandler.close();
    }
}
Also used : SimpleFormatter(java.util.logging.SimpleFormatter) Logger(java.util.logging.Logger) File(java.io.File) FileHandler(java.util.logging.FileHandler)

Aggregations

SimpleFormatter (java.util.logging.SimpleFormatter)100 FileHandler (java.util.logging.FileHandler)59 Logger (java.util.logging.Logger)36 File (java.io.File)28 Handler (java.util.logging.Handler)23 IOException (java.io.IOException)17 StreamHandler (java.util.logging.StreamHandler)16 Properties (java.util.Properties)15 ByteArrayOutputStream (java.io.ByteArrayOutputStream)14 LogRecord (java.util.logging.LogRecord)13 BalancerRunner (org.mobicents.tools.sip.balancer.BalancerRunner)13 Config (edu.neu.ccs.pyramid.configuration.Config)11 ConsoleHandler (java.util.logging.ConsoleHandler)10 Formatter (java.util.logging.Formatter)9 Test (org.junit.Test)7 MockResponse (com.google.mockwebserver.MockResponse)6 HttpClient (org.apache.http.client.HttpClient)6 HttpGet (org.apache.http.client.methods.HttpGet)6 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)6 Pair (edu.neu.ccs.pyramid.util.Pair)3