Example usage for java.util.logging Logger getLogger

List of usage examples for java.util.logging Logger getLogger

Introduction

In this page you can find the example usage for java.util.logging Logger getLogger.

Prototype




@CallerSensitive
public static Logger getLogger(String name) 

Source Link

Document

Find or create a logger for a named subsystem.

Usage

From source file:com.krawler.runtime.utils.URLClassLoaderUtil.java

public static void main(String[] args) {
    try {/*  ww  w  .  jav  a  2s  .com*/
        URLClassLoaderUtil urlcu = new URLClassLoaderUtil(
                new URL[] { new URL("file:///home/krawler/KrawlerJsonLib.jar") });
        urlcu.addFile("/home/krawler/KrawlerJsonLib.jar");
        Class c = Class.forName("com.krawler.utils.json.base.JSONObject");
        System.out.print(c.getCanonicalName());

    } catch (Exception ex) {
        Logger.getLogger(URLClassLoaderUtil.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:jparser.JParser.java

/**
 * @param args the command line arguments
 *//* w w w . j a  v  a 2 s .  c  om*/
public static void main(String[] args) {

    Options options = new Options();
    CommandLineParser parser = new DefaultParser();

    options.addOption(
            Option.builder().longOpt("to").desc("Indica el tipo de archivo al que debera convertir: JSON / XML")
                    .hasArg().argName("tipo").build());

    options.addOption(Option.builder().longOpt("path")
            .desc("Indica la ruta donde se encuentra el archivo origen").hasArg().argName("origen").build());

    options.addOption(
            Option.builder().longOpt("target").desc("Indica la ruta donde se guardara el archivo resultante")
                    .hasArg().argName("destino").build());

    options.addOption("h", "help", false, "Muestra la guia de como usar la aplicacion");

    try {
        CommandLine command = parser.parse(options, args);
        Path source = null;
        Path target = null;
        FactoryFileParse.TypeParce type = FactoryFileParse.TypeParce.NULL;
        Optional<Customer> customer = Optional.empty();

        if (command.hasOption("h")) {
            HelpFormatter helper = new HelpFormatter();
            helper.printHelp("JParser", options);

            System.exit(0);
        }

        if (command.hasOption("to"))
            type = FactoryFileParse.TypeParce.fromValue(command.getOptionValue("to", ""));

        if (command.hasOption("path"))
            source = Paths.get(command.getOptionValue("path", ""));

        if (command.hasOption("target"))
            target = Paths.get(command.getOptionValue("target", ""));

        switch (type) {
        case JSON:
            customer = FactoryFileParse.createNewInstance(FactoryFileParse.TypeParce.XML).read(source);

            break;

        case XML:
            customer = FactoryFileParse.createNewInstance(FactoryFileParse.TypeParce.JSON).read(source);

            break;
        }

        if (customer.isPresent()) {
            Customer c = customer.get();

            boolean success = FactoryFileParse.createNewInstance(type).write(c, target);

            System.out.println(String.format("Operatation was: %s", success ? "success" : "fails"));
        }

    } catch (ParseException ex) {
        Logger.getLogger(JParser.class.getSimpleName()).log(Level.SEVERE, ex.getMessage(), ex);

        System.exit(-1);
    }
}

From source file:com.mmone.gpdati.config.GpDatiDbRoomMap.java

public static void main(String[] args) {
    Database db = new Database("D:/tmp_desktop/scrigno-gpdati/data/gpdati.db");
    GpDatiDbRoomMap m = new GpDatiDbRoomMap(db);

    //MapUtils.debugPrint(System.out, "Rooms map", m);

    try {/*from  w  ww  .  j ava 2 s  .c  o m*/
        m.insert("zzzs1e", "zezzs1");
    } catch (SQLException ex) {
        Logger.getLogger(GpDatiDbRoomMap.class.getName()).log(Level.SEVERE, ex.getMessage());
        //Logger.getLogger(GpDatiDbRoomMap.class.getName()).log(Level.SEVERE, null, ex);
    }

    try {
        db.shutDown();
    } catch (SQLException ex) {
        Logger.getLogger(GpDatiDbRoomMap.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:de.burlov.amazon.s3.dirsync.CLI.java

/**
 * @param args//from w  ww  . j  a  v  a 2s.c  o m
 */
@SuppressWarnings("static-access")
public static void main(String[] args) {
    Logger.getLogger("").setLevel(Level.OFF);
    Logger deLogger = Logger.getLogger("de");
    deLogger.setLevel(Level.INFO);
    Handler handler = new ConsoleHandler();
    handler.setFormatter(new VerySimpleFormatter());
    deLogger.addHandler(handler);
    deLogger.setUseParentHandlers(false);
    //      if (true)
    //      {
    //         LogFactory.getLog(CLI.class).error("test msg", new Exception("test extception"));
    //         return;
    //      }
    Options opts = new Options();
    OptionGroup gr = new OptionGroup();

    /*
     * Befehlsgruppe initialisieren
     */
    gr = new OptionGroup();
    gr.setRequired(true);
    gr.addOption(OptionBuilder.withArgName("up|down").hasArg()
            .withDescription("Upload/Download changed or new files").create(CMD_UPDATE));
    gr.addOption(OptionBuilder.withArgName("up|down").hasArg()
            .withDescription("Upload/Download directory snapshot").create(CMD_SNAPSHOT));
    gr.addOption(OptionBuilder.withDescription("Delete remote folder").create(CMD_DELETE_DIR));
    gr.addOption(OptionBuilder.withDescription("Delete a bucket").create(CMD_DELETE_BUCKET));
    gr.addOption(OptionBuilder.create(CMD_HELP));
    gr.addOption(OptionBuilder.create(CMD_VERSION));
    gr.addOption(OptionBuilder.withDescription("Prints summary for stored data").create(CMD_SUMMARY));
    gr.addOption(OptionBuilder.withDescription("Clean up orphaned objekts").create(CMD_CLEANUP));
    gr.addOption(OptionBuilder.withDescription("Changes encryption password").withArgName("new password")
            .hasArg().create(CMD_CHANGE_PASSWORD));
    gr.addOption(OptionBuilder.withDescription("Lists all buckets").create(CMD_LIST_BUCKETS));
    gr.addOption(OptionBuilder.withDescription("Lists raw objects in a bucket").create(CMD_LIST_BUCKET));
    gr.addOption(OptionBuilder.withDescription("Lists files in remote folder").create(CMD_LIST_DIR));
    opts.addOptionGroup(gr);
    /*
     * Parametergruppe initialisieren
     */
    opts.addOption(OptionBuilder.withArgName("key").isRequired(false).hasArg().withDescription("S3 access key")
            .create(OPT_S3S_KEY));
    opts.addOption(OptionBuilder.withArgName("secret").isRequired(false).hasArg()
            .withDescription("Secret key for S3 account").create(OPT_S3S_SECRET));
    opts.addOption(OptionBuilder.withArgName("bucket").isRequired(false).hasArg().withDescription(
            "Optional bucket name for storage. If not specified then an unique bucket name will be generated")
            .create(OPT_BUCKET));
    // opts.addOption(OptionBuilder.withArgName("US|EU").hasArg().
    // withDescription(
    // "Where the new bucket should be created. Default US").create(
    // OPT_LOCATION));
    opts.addOption(OptionBuilder.withArgName("path").isRequired(false).hasArg()
            .withDescription("Local directory path").create(OPT_LOCAL_DIR));
    opts.addOption(OptionBuilder.withArgName("name").isRequired(false).hasArg()
            .withDescription("Remote directory name").create(OPT_REMOTE_DIR));
    opts.addOption(OptionBuilder.withArgName("password").isRequired(false).hasArg()
            .withDescription("Encryption password").create(OPT_ENC_PASSWORD));
    opts.addOption(OptionBuilder.withArgName("patterns").hasArgs()
            .withDescription("Comma separated exclude file patterns like '*.tmp,*/dir/*.tmp'")
            .create(OPT_EXCLUDE_PATTERNS));
    opts.addOption(OptionBuilder.withArgName("patterns").hasArgs().withDescription(
            "Comma separated include patterns like '*.java'. If not specified, then all files in specified local directory will be included")
            .create(OPT_INCLUDE_PATTERNS));

    if (args.length == 0) {
        printUsage(opts);
        return;
    }

    CommandLine cmd = null;
    try {
        cmd = new GnuParser().parse(opts, args);
        if (cmd.hasOption(CMD_HELP)) {
            printUsage(opts);
            return;
        }
        if (cmd.hasOption(CMD_VERSION)) {
            System.out.println("s3dirsync version " + Version.CURRENT_VERSION);
            return;
        }
        String awsKey = cmd.getOptionValue(OPT_S3S_KEY);
        String awsSecret = cmd.getOptionValue(OPT_S3S_SECRET);
        String bucket = cmd.getOptionValue(OPT_BUCKET);
        String bucketLocation = cmd.getOptionValue(OPT_LOCATION);
        String localDir = cmd.getOptionValue(OPT_LOCAL_DIR);
        String remoteDir = cmd.getOptionValue(OPT_REMOTE_DIR);
        String password = cmd.getOptionValue(OPT_ENC_PASSWORD);
        String exclude = cmd.getOptionValue(OPT_EXCLUDE_PATTERNS);
        String include = cmd.getOptionValue(OPT_INCLUDE_PATTERNS);

        if (StringUtils.isBlank(awsKey) || StringUtils.isBlank(awsSecret)) {
            System.out.println("S3 account data required");
            return;
        }

        if (StringUtils.isBlank(bucket)) {
            bucket = awsKey + ".dirsync";
        }

        if (cmd.hasOption(CMD_DELETE_BUCKET)) {
            if (StringUtils.isBlank(bucket)) {
                System.out.println("Bucket name required");
                return;
            }
            int deleted = S3Utils.deleteBucket(awsKey, awsSecret, bucket);
            System.out.println("Deleted objects: " + deleted);
            return;
        }
        if (cmd.hasOption(CMD_LIST_BUCKETS)) {
            for (String str : S3Utils.listBuckets(awsKey, awsSecret)) {
                System.out.println(str);
            }
            return;
        }
        if (cmd.hasOption(CMD_LIST_BUCKET)) {
            if (StringUtils.isBlank(bucket)) {
                System.out.println("Bucket name required");
                return;
            }
            for (String str : S3Utils.listObjects(awsKey, awsSecret, bucket)) {
                System.out.println(str);
            }
            return;
        }
        if (StringUtils.isBlank(password)) {
            System.out.println("Encryption password required");
            return;
        }
        char[] psw = password.toCharArray();
        DirSync ds = new DirSync(awsKey, awsSecret, bucket, bucketLocation, psw);
        ds.setExcludePatterns(parseSubargumenths(exclude));
        ds.setIncludePatterns(parseSubargumenths(include));
        if (cmd.hasOption(CMD_SUMMARY)) {
            ds.printStorageSummary();
            return;
        }
        if (StringUtils.isBlank(remoteDir)) {
            System.out.println("Remote directory name required");
            return;
        }
        if (cmd.hasOption(CMD_DELETE_DIR)) {
            ds.deleteFolder(remoteDir);
            return;
        }
        if (cmd.hasOption(CMD_LIST_DIR)) {
            Folder folder = ds.getFolder(remoteDir);
            if (folder == null) {
                System.out.println("No such folder found: " + remoteDir);
                return;
            }
            for (Map.Entry<String, FileInfo> entry : folder.getIndexData().entrySet()) {
                System.out.println(entry.getKey() + " ("
                        + FileUtils.byteCountToDisplaySize(entry.getValue().getLength()) + ")");
            }
            return;
        }
        if (cmd.hasOption(CMD_CLEANUP)) {
            ds.cleanUp();
            return;
        }
        if (cmd.hasOption(CMD_CHANGE_PASSWORD)) {
            String newPassword = cmd.getOptionValue(CMD_CHANGE_PASSWORD);
            if (StringUtils.isBlank(newPassword)) {
                System.out.println("new password required");
                return;
            }
            char[] chars = newPassword.toCharArray();
            ds.changePassword(chars);
            newPassword = null;
            Arrays.fill(chars, ' ');
            return;
        }
        if (StringUtils.isBlank(localDir)) {
            System.out.println(OPT_LOCAL_DIR + " argument required");
            return;
        }
        String direction = "";
        boolean up = false;
        boolean snapshot = false;
        if (StringUtils.isNotBlank(cmd.getOptionValue(CMD_UPDATE))) {
            direction = cmd.getOptionValue(CMD_UPDATE);
        } else if (StringUtils.isNotBlank(cmd.getOptionValue(CMD_SNAPSHOT))) {
            direction = cmd.getOptionValue(CMD_SNAPSHOT);
            snapshot = true;
        }
        if (StringUtils.isBlank(direction)) {
            System.out.println("Operation direction required");
            return;
        }
        up = StringUtils.equalsIgnoreCase(OPT_UP, direction);
        File baseDir = new File(localDir);
        if (!baseDir.exists() && !baseDir.mkdirs()) {
            System.out.println("Invalid local directory: " + baseDir.getAbsolutePath());
            return;
        }
        ds.syncFolder(baseDir, remoteDir, up, snapshot);

    } catch (DirSyncException e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    } catch (ParseException e) {
        System.out.println(e.getMessage());
        printUsage(opts);

    } catch (Exception e) {
        e.printStackTrace(System.err);
    }
}

From source file:chanupdater.ChanUpdater.java

/**
 * @param args the command line arguments
 *//*  w  w  w. ja  v a2 s .  com*/
public static void main(String[] args) {
    try {
        ChanUpdater me = new ChanUpdater();
        me.doit(args);
    } catch (Exception ex) {
        Logger.getLogger(ChanUpdater.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:di.uniba.it.tee2.search.Search.java

/**
 * language maindir query temp_query/* www  . ja  v a2  s.c  o  m*/
 *
 * @param args the command line arguments
 */
public static void main(String[] args) {
    try {
        CommandLine cmd = cmdParser.parse(options, args);
        if (cmd.hasOption("l") && cmd.hasOption("d") && cmd.hasOption("q")) {
            try {
                TemporalExtractor te = new TemporalExtractor(cmd.getOptionValue("l"));
                te.init();
                TemporalEventSearch search = new TemporalEventSearch(cmd.getOptionValue("d"), te);
                search.init();
                List<SearchResult> res = search.search(cmd.getOptionValue("q"), cmd.getOptionValue("t", ""),
                        100);
                for (SearchResult r : res) {
                    System.out.println(r);
                }
                search.close();
                te.close();
            } catch (Exception ex) {
                Logger.getLogger(Search.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp("Run searching", options, true);
        }
    } catch (ParseException ex) {
        Logger.getLogger(Search.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.openx.oauthdemo.Demo.java

/** 
 * Main class. OX3 with OAuth demo//from  w  w  w  .  j  a  v a 2  s . c om
 * @param args 
 */
public static void main(String[] args) {
    String apiKey, apiSecret, loginUrl, username, password, domain, path, requestTokenUrl, accessTokenUrl,
            realm, authorizeUrl;
    String propertiesFile = "default.properties";

    // load params from the properties file
    Properties defaultProps = new Properties();
    InputStream in = null;
    try {
        ClassLoader cl = ClassLoader.getSystemClassLoader();
        in = cl.getResourceAsStream(propertiesFile);
        if (in != null) {
            defaultProps.load(in);
        }
    } catch (IOException ex) {
        System.out.println("The properties file was not found!");
        return;
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException ex) {
                System.out.println("IO Error closing the properties file");
                return;
            }
        }
    }

    if (defaultProps.isEmpty()) {
        System.out.println("The properties file was not loaded!");
        return;
    }

    apiKey = defaultProps.getProperty("apiKey");
    apiSecret = defaultProps.getProperty("apiSecret");
    loginUrl = defaultProps.getProperty("loginUrl");
    username = defaultProps.getProperty("username");
    password = defaultProps.getProperty("password");
    domain = defaultProps.getProperty("domain");
    path = defaultProps.getProperty("path");
    requestTokenUrl = defaultProps.getProperty("requestTokenUrl");
    accessTokenUrl = defaultProps.getProperty("accessTokenUrl");
    realm = defaultProps.getProperty("realm");
    authorizeUrl = defaultProps.getProperty("authorizeUrl");

    // log in to the server
    Client cl = new Client(apiKey, apiSecret, loginUrl, username, password, domain, path, requestTokenUrl,
            accessTokenUrl, realm, authorizeUrl);
    try {
        // connect to the server
        cl.OX3OAuth();
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, "UTF-8 support needed for OAuth", ex);
    } catch (IOException ex) {
        Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, "IO file reading error", ex);
    } catch (Exception ex) {
        Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, "API issue", ex);
    }

    // now lets make a call to the api to check 
    String json;
    try {
        json = cl.getHelper().callOX3Api(domain, path, "account");
    } catch (IOException ex) {
        System.out.println("There was an error calling the API");
        return;
    }

    System.out.println("JSON response: " + json);

    Gson gson = new Gson();
    int[] accounts = gson.fromJson(json, int[].class);

    if (accounts.length > 0) {
        // let's get a single account
        try {
            json = cl.getHelper().callOX3Api(domain, path, "account", accounts[0]);
        } catch (IOException ex) {
            System.out.println("There was an error calling the API");
            return;
        }

        System.out.println("JSON response: " + json);

        OX3Account account = gson.fromJson(json, OX3Account.class);

        System.out.println("Account id: " + account.getId() + " name: " + account.getName());
    }
}

From source file:cz.muni.fi.mir.mathmlcanonicalization.MathMLCanonicalizerCommandLineTool.java

/**
 * @param args the command line arguments
 *///from   w w w.  j  a  v  a  2s.  co  m
public static void main(String[] args) throws FileNotFoundException, XMLStreamException {
    final Options options = new Options();
    options.addOption("c", true, "load configuration file");
    options.addOption("dtd", false,
            "enforce injection of XHTML + MathML 1.1 DTD reference into input documents");
    options.addOption("w", false, "overwrite input files by canonical outputs");
    options.addOption("h", false, "print help");

    final CommandLineParser parser = new PosixParser();
    CommandLine line = null;
    try {
        line = parser.parse(options, args);
    } catch (ParseException ex) {
        printHelp(options);
        System.exit(1);
    }

    File config = null;
    boolean overwrite = false;
    boolean dtdInjectionMode = false;
    if (line != null) {
        if (line.hasOption('c')) {
            config = new File(args[1]);
        }

        if (line.hasOption("dtd")) {
            dtdInjectionMode = true;
        }

        if (line.hasOption('w')) {
            overwrite = true;
        }

        if (line.hasOption('h')) {
            printHelp(options);
            System.exit(0);
        }

        final List<String> arguments = Arrays.asList(line.getArgs());
        if (arguments.size() > 0) {
            for (String arg : arguments) {
                try {
                    List<File> files = getFiles(new File(arg));
                    for (File file : files) {
                        canonicalize(file, config, dtdInjectionMode, overwrite);
                    }
                } catch (IOException ex) {
                    Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE,
                            ex.getMessage(), ex);
                } catch (ConfigException ex) {
                    Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE,
                            ex.getMessage(), ex);
                } catch (JDOMException ex) {
                    Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE,
                            ex.getMessage(), ex);
                } catch (ModuleException ex) {
                    Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE,
                            ex.getMessage(), ex);
                }
            }
        } else {
            printHelp(options);
            System.exit(0);
        }
    }
}

From source file:isc_415_practica_1.ISC_415_Practica_1.java

/**
 * @param args the command line arguments
 *//*from   w  w w  .j  a va2  s .  co m*/
public static void main(String[] args) {
    String urlString;
    Scanner input = new Scanner(System.in);
    Document doc;

    try {
        urlString = input.next();
        if (urlString.equals("servlet")) {
            urlString = "http://localhost:8084/ISC_415_Practica1_Servlet/client";
        }
        urlString = urlString.contains("http://") || urlString.contains("https://") ? urlString
                : "http://" + urlString;
        doc = Jsoup.connect(urlString).get();
    } catch (Exception ex) {
        System.out.println("El URL ingresado no es valido.");
        return;
    }

    ArrayList<NameValuePair> formInputParams;
    formInputParams = new ArrayList<>();
    String[] plainTextDoc = new TextNode(doc.html(), "").getWholeText().split("\n");
    System.out.println(String.format("Nmero de lineas del documento: %d", plainTextDoc.length));
    System.out.println(String.format("Nmero de p tags: %d", doc.select("p").size()));
    System.out.println(String.format("Nmero de img tags: %d", doc.select("img").size()));
    System.out.println(String.format("Nmero de form tags: %d", doc.select("form").size()));

    Integer index = 1;

    ArrayList<NameValuePair> urlParameters = new ArrayList<>();
    for (Element e : doc.select("form")) {
        System.out.println(String.format("Form %d: Nmero de Input tags %d", index, e.select("input").size()));
        System.out.println(e.select("input"));

        for (Element formInput : e.select("input")) {
            if (formInput.attr("id") != null && formInput.attr("id") != "") {
                urlParameters.add(new BasicNameValuePair(formInput.attr("id"), "PRACTICA1"));
            } else if (formInput.attr("name") != null && formInput.attr("name") != "") {
                urlParameters.add(new BasicNameValuePair(formInput.attr("name"), "PRACTICA1"));
            }
        }

        index++;
    }

    if (!urlParameters.isEmpty()) {
        try {
            CloseableHttpClient httpclient = HttpClients.createDefault();
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(urlParameters, Consts.UTF_8);
            HttpPost httpPost = new HttpPost(urlString);
            httpPost.setHeader("User-Agent", USER_AGENT);
            httpPost.setEntity(entity);
            HttpResponse response = httpclient.execute(httpPost);
            System.out.println(response.getStatusLine());
        } catch (IOException ex) {
            Logger.getLogger(ISC_415_Practica_1.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

}

From source file:core.PlanC.java

/**
 * inicio de aplicacion/*from  www . j  ava2 s. co m*/
 * 
 * @param arg - argumentos de entrada
 */
public static void main(String[] args) {

    // user.name

    /*
     * Properties prp = System.getProperties(); System.out.println(getWmicValue("bios", "SerialNumber"));
     * System.out.println(getWmicValue("cpu", "SystemName"));
     */

    try {
        // log
        // -Djava.util.logging.SimpleFormatter.format='%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n'
        // System.setProperty("java.util.logging.SimpleFormatter.format",
        // "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n");
        System.setProperty("java.util.logging.SimpleFormatter.format",
                "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %5$s%6$s%n");

        FileHandler fh = new FileHandler(LOG_FILE);
        fh.setFormatter(new SimpleFormatter());
        fh.setLevel(Level.INFO);
        ConsoleHandler ch = new ConsoleHandler();
        ch.setFormatter(new SimpleFormatter());
        ch.setLevel(Level.INFO);
        logger = Logger.getLogger("");
        Handler[] hs = logger.getHandlers();
        for (int x = 0; x < hs.length; x++) {
            logger.removeHandler(hs[x]);
        }
        logger.addHandler(fh);
        logger.addHandler(ch);
        // point apache log to this log
        System.setProperty("org.apache.commons.logging.Log", Jdk14Logger.class.getName());

        TPreferences.init();
        TStringUtils.init();

        Font fo = Font.createFont(Font.TRUETYPE_FONT, TResourceUtils.getFile("Dosis-Light.ttf"));
        GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo);
        fo = Font.createFont(Font.TRUETYPE_FONT, TResourceUtils.getFile("Dosis-Medium.ttf"));
        GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo);
        fo = Font.createFont(Font.TRUETYPE_FONT, TResourceUtils.getFile("AERO_ITALIC.ttf"));
        GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo);

        SwingTimerTimingSource ts = new SwingTimerTimingSource();
        AnimatorBuilder.setDefaultTimingSource(ts);
        ts.init();

        // parse app argument parameters and append to tpreferences to futher uses
        for (String arg : args) {
            String[] kv = arg.split("=");
            TPreferences.setProperty(kv[0], kv[1]);
        }
        RUNNING_MODE = TPreferences.getProperty("runningMode", RM_NORMAL);

        newMsg = Applet.newAudioClip(TResourceUtils.getURL("newMsg.wav"));

    } catch (Exception e) {
        SystemLog.logException1(e, true);
    }

    // pass icon from metal to web look and feel
    Icon i1 = UIManager.getIcon("OptionPane.errorIcon");
    Icon i2 = UIManager.getIcon("OptionPane.informationIcon");
    Icon i3 = UIManager.getIcon("OptionPane.questionIcon");
    Icon i4 = UIManager.getIcon("OptionPane.warningIcon");
    // Object fcui = UIManager.get("FileChooserUI");
    // JFileChooser fc = new JFileChooser();

    WebLookAndFeel.install();
    // WebLookAndFeel.setDecorateFrames(true);
    // WebLookAndFeel.setDecorateDialogs(true);

    UIManager.put("OptionPane.errorIcon", i1);
    UIManager.put("OptionPane.informationIcon", i2);
    UIManager.put("OptionPane.questionIcon", i3);
    UIManager.put("OptionPane.warningIcon", i4);
    // UIManager.put("TFileChooserUI", fcui);

    // warm up the IDW.
    // in my computer, some weird error ocurr if i don't execute this preload.
    new RootWindow(null);

    frame = new TWebFrame();
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            Exit.shutdown();
        }
    });

    if (RUNNING_MODE.equals(RM_NORMAL)) {
        initEnviorement();
    }
    if (RUNNING_MODE.equals(RM_CONSOLE)) {
        initConsoleEnviorement();
    }

    if (RUNNING_MODE.equals(ONE_TASK)) {
        String cln = TPreferences.getProperty("taskName", "*TaskNotFound");
        PlanC.logger.log(Level.INFO, "OneTask parameter found in .properties. file Task name = " + cln);
        try {
            Class cls = Class.forName(cln);
            Object dobj = cls.newInstance();
            // new class must be extends form AbstractExternalTask
            TTaskManager.executeTask((Runnable) dobj);
            return;
        } catch (Exception e) {
            PlanC.logger.log(Level.SEVERE, e.getMessage(), e);
            Exit.shutdown();
        }
    }
}