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.me.DAO.DAO.java

public DAO() {
    driver = "com.mysql.jdbc.Driver";
    dburl = "jdbc:mysql://localhost/booksdb";
    dbuser = "root";
    dbpassword = "mansijain";

    try {/*from w ww . j a  va 2s  .co m*/
        Class.forName(driver);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(DAO.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.wegas.app.IntegrationTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    BootstrapProperties bootstrapProperties = new BootstrapProperties();
    //bootstrapProperties.setInstallRoot("./src/test/glassfish");           // Only for glassfish-embedded-staticshell

    GlassFishProperties glassfishProperties = new GlassFishProperties();
    glassfishProperties.setPort("https-listener", 5353);
    glassfishProperties.setPort("http-listener", 5454);
    //glassfishProperties.setInstanceRoot("./src/test/glassfish/domains/domain1");
    glassfishProperties.setConfigFileURI(
            (new File("./src/test/glassfish/domains/domain1/config/domain.xml")).toURI().toString());
    //glassfishProperties.setConfigFileReadOnly(false);
    TestHelper.resetTestDB();/* w w w  .  j  a  va2  s .co m*/
    glassfish = GlassFishRuntime.bootstrap(bootstrapProperties).newGlassFish(glassfishProperties);
    Logger.getLogger("javax.enterprise.system.tools.deployment").setLevel(Level.OFF);
    Logger.getLogger("javax.enterprise.system").setLevel(Level.OFF);
    glassfish.start();

    //File war = new File("./target/Wegas.war");
    //appName = glassfish.getDeployer().deploy(war, "--name=Wegas", "--contextroot=Wegas", "--force=true");
    // deployer.deploy(war);
    ScatteredArchive archive = new ScatteredArchive("Wegas", ScatteredArchive.Type.WAR,
            new File("./target/embed-war/"));
    archive.addClassPath(new File("./target/classes/")); // target/classes directory contains complied servlets
    archive.addClassPath(new File("../wegas-core/target/classes")); // wegas-core dependency
    //archive.addClassPath(new File("../wegas-core/target/wegas-core_1.0-SNAPSHOT.jar"));// wegas-core dependency
    //archive.addMetadata(new File("./src/main/webapp/WEB-INF", "web.xml"));// resources/sun-web.xml is the WEB-INF/sun-web.xml
    //archive.addMetadata(new File("./src/main/webapp/test", "web.xml"));   // resources/web.xml is the WEB-INF/web.xml
    appName = glassfish.getDeployer().deploy(archive.toURI(), "--contextroot=Wegas"); // Deploy the scattered web archive.

    setBaseUrl("http://localhost:5454/Wegas");
}

From source file:com.chingo247.structureapi.plan.PlanGenerator.java

public static void generate(File directory) {
    Iterator<File> fileIterator = FileUtils.iterateFiles(directory, new String[] { "schematic" }, true);

    while (fileIterator.hasNext()) {
        File schemaFile = fileIterator.next();
        try {/*from www  .j  a  v  a2 s  .  c o  m*/
            generatePlanFromSchematic(schemaFile, directory);
        } catch (IOException ex) {
            Logger.getLogger(PlanGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:css.variable.converter.CSSVariableConverter.java

public static void start(File sourceDirectory, File releaseDirectory) {

    try {/* w  ww .  ja  v  a 2s .c  om*/
        FileUtils.copyDirectory(sourceDirectory, releaseDirectory);
        loadCSSFiles(releaseDirectory);// Find those CSS files
        File mainFile = getMainCSSFile();// Ask which file is the main file(so we can get variables)
        ArrayList<CSSVar> rootCSSVars = getCSSVars(mainFile, ":root");// Collect variables from main file
        editForRelease(rootCSSVars);// Go through existing CSS Files and replace variable access with variable values
    } catch (IOException ex) {
        Logger.getLogger(CSSVariableConverter.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:File.TXT.ReadFile.java

/**
 * @param args the command line arguments
 *///from  ww  w .  j  a va2s .  com
public String read(String path, String nama_file) {

    String hasil = "";
    File f = new File(path + nama_file);
    if (f.canRead()) {
        try {
            hasil = FileUtils.readFileToString(f);
            return hasil;
        } catch (IOException ex) {
            hasil = ex.getMessage();
            Logger.getLogger(ReadFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return hasil;
}

From source file:com.searchbox.utils.DecryptLicense.java

public static boolean checkLicense(String lkey, String productName) {
    try {/*from   w  w  w  . j  a  v a 2 s  .c  o m*/
        String licval = new String(decrypt(Base64.decodeBase64(lkey)));
        String[] lines = licval.split("\n");
        boolean datecheck = checkDate(lines[1]);
        return datecheck & lines[2].contains(productName);
    } catch (Exception ex) {
        Logger.getLogger(DecryptLicense.class.getName()).log(Level.SEVERE, null, ex);
    }
    return false;
}

From source file:havocx42.Program.java

private static void initRootLogger() throws SecurityException, IOException {

    FileHandler fileHandler;//  w ww.  j  a  va  2 s . c  o m
    fileHandler = new FileHandler("PRWeaponStats.%u.%g.txt", 1024 * 1024 * 8, 3, false);
    fileHandler.setLevel(Level.FINEST);
    fileHandler.setFormatter(new SimpleFormatter());
    Logger rootLogger = Logger.getLogger("");
    Handler[] handlers = rootLogger.getHandlers();
    for (Handler handler : handlers) {
        handler.setLevel(Level.INFO);
    }
    rootLogger.setLevel(Level.FINEST);
    rootLogger.addHandler(fileHandler);
}

From source file:com.juicioenlinea.application.secutiry.Security.java

public static String encriptar(String texto) {

    final String secretKey = "hunter"; //llave para encriptar datos
    String encryptedString = null;

    try {//  ww w  .j a  v a 2s .  com

        MessageDigest md = MessageDigest.getInstance("SHA");
        byte[] digestOfPassword = md.digest(secretKey.getBytes("UTF-8"));
        byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);

        SecretKey key = new SecretKeySpec(keyBytes, "DESede");
        Cipher cipher = Cipher.getInstance("DESede");
        cipher.init(Cipher.ENCRYPT_MODE, key);

        byte[] plainTextBytes = texto.getBytes("UTF-8");
        byte[] buf = cipher.doFinal(plainTextBytes);
        byte[] base64Bytes = Base64.encodeBase64(buf);
        encryptedString = new String(base64Bytes);

    } catch (NoSuchAlgorithmException | UnsupportedEncodingException | NoSuchPaddingException
            | InvalidKeyException | IllegalBlockSizeException | BadPaddingException ex) {
        Logger.getLogger(Security.class.getName()).log(Level.SEVERE, null, ex);
    }
    return encryptedString;
}

From source file:de.kaojo.chat.TextMessageEncoder.java

@Override
public String encode(Message object) throws EncodeException {
    ObjectMapper mapper = new ObjectMapper();
    try {//from   ww w.  j  av a 2s  . c o m
        return mapper.writeValueAsString(object);
    } catch (JsonProcessingException ex) {
        Logger.getLogger(TextMessageEncoder.class.getName()).log(Level.SEVERE, null, ex);
        throw new EncodeException(object, "Could not encode Message", ex);
    }
}

From source file:com._8x8.logic.service.QRCodeService.java

@Override
public ByteArrayOutputStream getQRCodeBytesStream(String text) {

    String encryptQRCodeTxt = "";
    try {/*w  ww .j  a v  a  2 s .  co m*/
        encryptQRCodeTxt = _encryptorService.encryptCode(text);
    } catch (Exception ex) {
        Logger.getLogger(QRCodeService.class.getName()).log(Level.SEVERE, null, ex);
    }

    ByteArrayOutputStream stream = QRCode.from(encryptQRCodeTxt).stream();
    return stream;
}