Example usage for java.util.logging Level INFO

List of usage examples for java.util.logging Level INFO

Introduction

In this page you can find the example usage for java.util.logging Level INFO.

Prototype

Level INFO

To view the source code for java.util.logging Level INFO.

Click Source Link

Document

INFO is a message level for informational messages.

Usage

From source file:org.activiti.explorer.cache.TrieBasedUserCache.java

public synchronized void loadUsers() {
    long nrOfUsers = identityService.createUserQuery().count();
    long usersAdded = 0;

    userTrie = new RadixTreeImpl<List<User>>();
    userCache = new HashMap<String, User>();
    keyCache = new HashMap<String, List<String>>();

    while (usersAdded < nrOfUsers) {

        if (LOGGER.isLoggable(Level.INFO)) {
            LOGGER.info("Caching users " + usersAdded + " to " + (usersAdded + 25));
        }/*from   w  w  w.ja v a  2  s  .co m*/

        List<User> users = identityService.createUserQuery().listPage((int) usersAdded, 25);
        for (User user : users) {
            addTrieItem(user);
            addUserCacheItem(user);

            usersAdded++;
        }
    }
}

From source file:com.elasticgrid.amazon.sdb.impl.SimpleDBImpl.java

public List<Domain> listDomains() throws SimpleDBException {
    try {//from w  w w.  j av  a  2s.  c  om
        logger.info("Searching for all domains");
        ListDomainsResult raw = sdb.listDomains();
        List<Domain> domains = new ArrayList<Domain>(raw.getDomainList().size());
        for (com.xerox.amazonws.sdb.Domain domain : raw.getDomainList()) {
            domains.add(new DomainImpl(domain));
        }
        logger.log(Level.INFO, "Found {0} domain(s)", domains.size());
        return domains;
    } catch (SDBException e) {
        throw new SimpleDBException("Can't list domains", e);
    }
}

From source file:com.microsoftopentechnologies.windowsazurestorage.helper.CredentialMigration.java

/**
 *
 * Take the legacy local storage credential configuration and create an
 * equivalent global credential in Jenkins Credential Store
 *
 *///from  w  w  w . j  av a2  s .  c o m
private static void removeFile(String sourceFile) throws IOException {
    File file = new File(sourceFile);

    if (file.delete()) {
        LOGGER.log(Level.INFO, file.getName() + " is deleted!");
    } else {
        LOGGER.log(Level.WARNING, file.getName() + "deletion is failed.");
    }
}

From source file:at.ac.tuwien.dsg.esperstreamprocessing.service.TaskDelivery.java

public void logDetectedEvent(String dafName, String eventValues, String severity) {

    Date dNow = new Date();
    SimpleDateFormat ft = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
    String detectedTime = ft.format(dNow);

    String ip = Configuration.getConfiguration("DB.CLOUDLYRA.IP");
    String port = Configuration.getConfiguration("DB.CLOUDLYRA.PORT");
    String database = Configuration.getConfiguration("DB.CLOUDLYRA.DATABASE");
    String username = Configuration.getConfiguration("DB.CLOUDLYRA.USERNAME");
    String password = Configuration.getConfiguration("DB.CLOUDLYRA.PASSWORD");

    MySqlConnectionManager connectionManager = new MySqlConnectionManager(ip, port, database, username,
            password);/*w w  w  . ja v  a2  s. c  o  m*/

    String sql = "INSERT INTO Event (daf,detected_time,event_values,severity) " + "VALUES ('" + dafName + "','"
            + detectedTime + "','" + eventValues + "','" + severity + "')";

    Logger.getLogger(EventHandler.class.getName()).log(Level.INFO, sql);
    connectionManager.ExecuteUpdate(sql);

}

From source file:com.skynetcomputing.skynetclient.WorkManagerTest.java

/**
 * Test of start method, of class WorkManager.
 *
 * @throws java.io.IOException//from   www.  j  a v a 2 s.c o m
 * @throws java.lang.InterruptedException
 */
@Test
public void testStart() throws IOException, InterruptedException {
    IConnectionMgr conn = new IConnectionMgr() {
        @Override
        public void sendFile(File aFile) {
            try {
                Files.copy(aFile.toPath(), new File(LOCAL_INPUT_DIR + aFile.getName()).toPath(),
                        StandardCopyOption.REPLACE_EXISTING);
            } catch (IOException ex) {
                Logger.getLogger(WorkManagerTest.class.getName()).log(Level.SEVERE, "Error sending file", ex);
            }
        }

        @Override
        public void notifyJarOKNOK(boolean isOK) throws IOException {
            assertTrue("Checking Jar presence", isOK);
        }

        @Override
        public void notifyTaskCompleted() throws IOException {
            Logger.getLogger(WorkManagerTest.class.getName()).log(Level.INFO, "Task Completed");
            synchronized (isRunning) {
                isRunning.set(false);
                isRunning.notifyAll();
            }
        }

        @Override
        public void start(InetSocketAddress serverAddress) {
            System.out.println("Fake start listening..");
        }

        @Override
        public boolean isSendingFiles() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void notifyTaskStarting() throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    };

    WorkManager workMgr = new WorkManager(conn, ROOT_DIR);
    // Read only, should not be used for saving files
    PersistenceManager persistMgr = new PersistenceManager(ROOT_DIR);

    File testDir = new File(MANDELTASK_DIR);
    File jobJar = FileUtils.listFiles(testDir, new String[] { "jar" }, false).iterator().next();
    workMgr.onJarReceived(jobJar);
    File localDir = new File(LOCAL_INPUT_DIR);
    FileUtils.deleteDirectory(localDir);
    localDir.mkdirs();
    for (File f : testDir.listFiles()) {
        Files.copy(f.toPath(), new File(LOCAL_INPUT_DIR + f.getName()).toPath(),
                StandardCopyOption.REPLACE_EXISTING);
    }

    for (int i = 1; i <= 4; i++) {
        isRunning.getAndSet(true);
        File taskJson = new File(localDir, i + ".task");
        File jobData = new File(localDir, i + ".data");

        workMgr.onTaskReceived(taskJson);
        workMgr.onDataReceived(jobData);

        synchronized (isRunning) {
            while (isRunning.get()) {
                isRunning.wait();
            }
        }
    }

    isRunning.getAndSet(true);

    File combineTaskFile = new File(localDir, "20" + SrzTask.EXT);
    workMgr.onTaskReceived(combineTaskFile);

    SrzTask combineTask = persistMgr.readTaskFile(combineTaskFile);
    for (int id : combineTask.getDependencies()) {
        workMgr.onDataReceived(new File(localDir, id + SrzData.EXT));
    }

    synchronized (isRunning) {
        while (isRunning.get()) {
            isRunning.wait();
        }
    }

    Logger.getLogger(WorkManagerTest.class.getName()).log(Level.INFO, "Test Finished");
}

From source file:com.elasticbox.jenkins.k8s.services.slavesprovisioning.chain.steps.CheckProvisioningAllowed.java

/**
 * Its mission is to check if we can provision one slave more. It will be impossible if we have already reached
 * the specific limit for the cloud/*  w  w  w  .  j  ava 2 s . co  m*/
 */
@Override
public void handle(PodDeploymentContext deploymentContext) throws ServiceException {

    final KubernetesCloud cloudToDeployInto = deploymentContext.getCloudToDeployInto();

    final int cloudCapacity = cloudToDeployInto.getInstanceCap();

    if (cloudCapacity == 0) {
        //is not possible to deploy any slave in this kubernetes cloud
        String message = "It is impossible to deploy a slave in a cloud which capacity is zero";
        LOGGER.log(Level.SEVERE, message);
        throw new RuntimeException(message);
    }

    String deploymentNamespace = StringUtils.isNotBlank(deploymentContext.getDeploymentNamespace())
            ? deploymentContext.getDeploymentNamespace()
            : cloudToDeployInto.getNamespace();

    try {

        final List<Pod> pods = podRepository.getAllPods(cloudToDeployInto.getName(), deploymentNamespace);

        if (pods.size() >= cloudCapacity) {
            String message = "Not provisioning, max cloud capacity: " + cloudCapacity + "reached";
            LOGGER.log(Level.SEVERE, message);
            throw new ServiceException(message);
        }

        LOGGER.log(Level.INFO, "Pod deployment granted, cloud capacity: " + pods.size());

    } catch (RepositoryException e) {

        LOGGER.log(Level.SEVERE,
                "Error getting the kubernetes client for the cloud " + cloudToDeployInto.getName());

        throw new ServiceException(
                "Error getting the kubernetes client for the cloud " + cloudToDeployInto.getName());
    }
}

From source file:fileoperations.FileOperations.java

public static boolean writeCollectionToFile(Collection<String> objToWrite, String delimiter,
        String fileToWrite) {//from  ww  w .j ava 2  s  .  c  om
    loggerObj.log(Level.INFO, "inside writeObjectToFile method");
    BufferedWriter bw = null;
    loggerObj.log(Level.INFO, "File to write the object is:" + fileToWrite);
    File file = new File(fileToWrite);

    try {
        if (file.exists()) {
            file.delete();
        }
        if (!file.exists()) {
            file.createNewFile();
            loggerObj.log(Level.INFO,
                    "File did not exist before: so created new one with the name: " + fileToWrite);
        }
        FileWriter fw = new FileWriter(file, true);
        bw = new BufferedWriter(fw);
        for (String i : objToWrite) {
            bw.write(i.toString() + ",");
        }

    } catch (IOException ex) {

        loggerObj.log(Level.SEVERE,
                "Error in writing to the file:" + fileToWrite + "\n Exception is " + ex.toString());
        return false;
    } catch (Exception ex) {
        loggerObj.log(Level.SEVERE,
                "Error in writing to the file:" + fileToWrite + "\n Exception is " + ex.toString());
        return false;
    } finally {
        try {
            if (bw != null) {
                bw.close();
            }
        } catch (IOException ex) {
            loggerObj.log(Level.SEVERE, "Error in closing the file:" + fileToWrite + " after reading");
            return false;
        }

    }
    loggerObj.log(Level.INFO, "Successfully written the object to: " + fileToWrite);
    return true;
}

From source file:adalid.jaas.google.GoogleRecaptcha.java

private static String secretKey() {
    logger.log(Level.INFO, VALIDATOR_KEY + " = {0}", GoogleRecaptcha.class.getName());
    String secretKey = System.getProperties().getProperty(SECRET_KEY_PROPERTY_KEY);
    if (secretKey == null || secretKey.isEmpty()) {
        String path = secretKeyFilePath();
        File file = new File(path);
        if (file.isFile()) {
            logger.log(TRACE, SECRET_KEY_FILE_PROPERTY_KEY + " = {0}", path);
            try {
                secretKey = new Scanner(file).useDelimiter("\\Z").next();
            } catch (FileNotFoundException ex) {
                logger.log(Level.WARNING, SECRET_KEY_FILE_PROPERTY_KEY + " {0} is missing", path);
            }//from   w w  w.  ja v  a 2 s.c  o m
        } else {
            logger.log(Level.WARNING, SECRET_KEY_FILE_PROPERTY_KEY + " {0} is missing or invalid", path);
        }
    }
    if (secretKey == null || secretKey.isEmpty()) {
        logger.log(Level.WARNING, MISSING_SECRET_KEY);
        return DEFAULT_SECRET_KEY;
    }
    return secretKey;
}

From source file:eu.optimis.ip.gui.client.resources.Accounting.java

/**
 * If DB server is not running, runs it.
 * If Database tables are not created, it creates them.
 * Also prepares all the SQL statements.
 *//*w w  w .  j  a  v  a 2 s .c om*/
private void start() {
    serverThread.startServer();
    try {
        Class.forName(dbconfig.getString("driver"));
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
        throw new RuntimeException(ex.getMessage(), ex);
    }

    // If SA user has no password (because the DB does not exist), it creates the SA user and a read-only-user
    try {
        Connection saConnection = DriverManager.getConnection(dbconfig.getString("url"),
                dbconfig.getString("sa.username"), "");
        PreparedStatement ps = saConnection
                .prepareStatement("SET PASSWORD '" + dbconfig.getProperty("sa.password") + "';");
        ps.executeUpdate();
        ps.close();
        saConnection.close();
    } catch (SQLInvalidAuthorizationSpecException ex) {
        Logger.getLogger(Accounting.class.getName()).log(Level.INFO,
                "SA user has already a password. Neither new users are creater nor permissions are re-assigned");
    } catch (SQLException ex) {
        ex.printStackTrace();
    }

    try {
        connection = DriverManager.getConnection(dbconfig.getString("url"), dbconfig.getString("sa.username"),
                dbconfig.getString("sa.password"));
        createDB();

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

    // Drops already defined RO (read-only) user, and creates a new with the password specified in scheduler.properties
    try {
        PreparedStatement ps = connection
                .prepareStatement("DROP USER " + dbconfig.getProperty("ro.username") + ";");
        ps.executeUpdate();
        ps.close();
    } catch (SQLInvalidAuthorizationSpecException ex) {
        Logger.getLogger(Accounting.class.getName()).log(Level.INFO,
                "Don't dropping read-only user because does not exist. Creating...");
    } catch (SQLException ex) {
        Logger.getLogger(Accounting.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
    }
}