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:com.neophob.sematrix.output.ArtnetDevice.java

/**
 * /* w w  w  .  j a  v a2s .  co m*/
 * @param controller
 */
public ArtnetDevice(ApplicationConfigurationHelper ph, PixelControllerOutput controller) {
    super(OutputDeviceEnum.ARTNET, ph, controller, 8);

    this.initialized = false;
    this.artnet = new ArtNet();
    try {
        this.pixelsPerUniverse = ph.getArtNetPixelsPerUniverse();
        this.targetAdress = InetAddress.getByName(ph.getArtNetIp());
        this.firstUniverseId = ph.getArtNetStartUniverseId();
        String broadcastAddr = ph.getArtNetBroadcastAddr();
        if (StringUtils.isBlank(broadcastAddr)) {
            broadcastAddr = ArtNetServer.DEFAULT_BROADCAST_IP;
        }

        LOG.log(Level.INFO, "Initialize ArtNet device IP: {0}, broadcast IP: {1}, Port: {2}",
                new Object[] { this.targetAdress.toString(), broadcastAddr, ArtNetServer.DEFAULT_PORT });

        this.artnet.init();
        this.artnet.setBroadCastAddress(broadcastAddr);
        this.artnet.start();
        this.artnet.getNodeDiscovery().addListener(this);
        this.artnet.startNodeDiscovery();

        //check how many universe we need
        this.nrOfUniverse = 1;
        int bufferSize = xResolution * yResolution;
        if (bufferSize > pixelsPerUniverse) {
            while (bufferSize > pixelsPerUniverse) {
                this.nrOfUniverse++;
                bufferSize -= pixelsPerUniverse;
            }
        }

        this.initialized = true;
        LOG.log(Level.INFO, "ArtNet device initialized using {0} universe with {1} pixels.",
                new Object[] { this.nrOfUniverse, this.pixelsPerUniverse });

    } catch (BindException e) {
        LOG.log(Level.WARNING, "\nFailed to initialize ArtNet device:", e);
        LOG.log(Level.WARNING, "Make sure no ArtNet Tools like DMX-Workshop are running!\n\n");
    } catch (Exception e) {
        LOG.log(Level.WARNING, "Failed to initialize ArtNet device:", e);
    }
}

From source file:org.geosdi.wps.utility.GeoServerUtils.java

public NamespaceInfo getNamespace(WorkspaceInfo crismaWorkspace) {
    NamespaceInfo namespace = catalog.getNamespaceByPrefix(crismaWorkspace.getName());
    if (namespace == null) {
        logger.log(Level.INFO, "Automatically creating namespace for workspace " + crismaWorkspace.getName());

        namespace = catalog.getFactory().createNamespace();
        namespace.setPrefix(crismaWorkspace.getName());
        namespace.setURI("http://" + crismaWorkspace.getName());
        catalog.add(namespace);/*from   w  w  w.j  ava  2 s.c om*/
    }
    return namespace;
}

From source file:com.neophob.sematrix.generator.Image.java

/**
 * load a new file./*from   w  ww  . j  av a  2  s .co  m*/
 *
 * @param filename the filename
 */
public void loadFile(String filename) {
    //only load if needed
    if (StringUtils.equals(filename, this.filename)) {
        LOG.log(Level.INFO, "new filename does not differ from old: " + Image.PREFIX + filename);
        return;
    }

    this.filename = filename;
    try {
        PImage img = Collector.getInstance().getPapplet().loadImage(Image.PREFIX + filename);
        if (img == null || img.height < 2) {
            LOG.log(Level.WARNING, "could not load " + Image.PREFIX + filename + " " + img);
            return;
        }

        LOG.log(Level.INFO,
                "resize to img " + filename + " " + internalBufferXSize + ", " + internalBufferYSize);
        PixelControllerResize res = Collector.getInstance().getPixelControllerResize();
        img.loadPixels();
        this.internalBuffer = res.resizeImage(RESIZE_TYP, img.pixels, img.width, img.height,
                internalBufferXSize, internalBufferYSize);
        img.updatePixels();

        //this.internalBuffer = ColorSet.convertToColorSetImage(internalBuffer, cs);
        short r, g, b;
        int rgbColor;

        //greyscale it
        for (int i = 0; i < internalBuffer.length; i++) {
            rgbColor = internalBuffer[i];
            r = (short) ((rgbColor >> 16) & 255);
            g = (short) ((rgbColor >> 8) & 255);
            b = (short) (rgbColor & 255);
            int val = (int) (r * 0.3f + g * 0.59f + b * 0.11f);
            internalBuffer[i] = val;
        }

    } catch (Exception e) {
        LOG.log(Level.WARNING, "Failed to load image {0}: {1}", new Object[] { Image.PREFIX + filename, e });
    }
}

From source file:it.geosolutions.geoserver.jms.JMSManager.java

/**
 * Method to make lookup using the type of the passed eventType.
 * /*from   w w w  .j  a  v a 2s. c o  m*/
 * @param <S>
 * @param <O>
 * @param eventType
 * @return the handler
 * @throws IllegalArgumentException
 */
public <S extends Serializable, O> JMSEventHandler<S, O> getHandler(final O eventType)
        throws IllegalArgumentException {
    final Set<?> beanSet = beans.entrySet();
    // declare a tree set to define the handler priority
    final Set<JMSEventHandlerSPI<S, O>> candidates = new TreeSet<JMSEventHandlerSPI<S, O>>(
            new Comparator<JMSEventHandlerSPI<S, O>>() {
                @Override
                public int compare(JMSEventHandlerSPI<S, O> o1, JMSEventHandlerSPI<S, O> o2) {
                    if (o1.getPriority() < o2.getPriority())
                        return -1;
                    else if (o1.getPriority() == o2.getPriority()) {
                        return 0;
                        // } else if (o1.getPriority()>o2.getPriority()){
                    } else {
                        return 1;
                    }
                }
            });
    // for each handler check if it 'canHandle' the incoming object if so
    // add it to the tree
    for (final Iterator<?> it = beanSet.iterator(); it.hasNext();) {
        final Map.Entry<String, ?> entry = (Entry<String, ?>) it.next();

        final JMSEventHandlerSPI<S, O> spi = (JMSEventHandlerSPI) entry.getValue();
        if (spi != null) {
            if (spi.canHandle(eventType)) {
                if (LOGGER.isLoggable(Level.INFO))
                    LOGGER.info("Creating an instance of: " + spi.getClass());
                candidates.add(spi);
            }
        }
    }
    // TODO return the entire tree leaving choice to the caller (useful to
    // build a failover list)
    // return the first available handler
    final Iterator<JMSEventHandlerSPI<S, O>> it = candidates.iterator();
    while (it.hasNext()) {
        try {
            final JMSEventHandler<S, O> handler = it.next().createHandler();
            if (handler != null)
                return handler;
        } catch (Exception e) {
            if (LOGGER.isLoggable(Level.WARNING))
                LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
        }

    }
    final String message = "Unable to find the needed Handler SPI for event of type: "
            + eventType.getClass().getCanonicalName();
    if (LOGGER.isLoggable(Level.WARNING))
        LOGGER.warning(message);
    throw new IllegalArgumentException(message);
}

From source file:com.boha.rivers.gate.PhotoServlet.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods./*from   w w  w. j  a v a  2  s.co m*/
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("application/json;charset=UTF-8");
    PrintWriter out = response.getWriter();
    long start = System.currentTimeMillis();

    ResponseDTO ur = new ResponseDTO();
    String json;
    Gson gson = new Gson();
    try {
        boolean isMultipart = ServletFileUpload.isMultipartContent(request);
        if (isMultipart) {
            //ur = photoUtil.downloadPhotos(request, dataUtil, platformUtil);
        } else {
            RequestDTO dto = getRequest(gson, request);
            switch (dto.getRequestType()) {

            }

        }

    } catch (Exception e) {
        logger.log(Level.SEVERE, "Servlet file upload FAILED, check it out!", e);
        ur.setStatusCode(113);
        ur.setMessage("Error. Generic server exception");

    } finally {
        json = gson.toJson(ur);
        out.println(json);
        out.close();
        long end = System.currentTimeMillis();
        logger.log(Level.INFO, "PhotoServlet done, elapsed: {0} seconds", getElapsed(start, end));
    }
}

From source file:com.telefonica.euro_iaas.sdc.manager.impl.ProductManagerImpl.java

public Product insert(Product product, String tenantId)
        throws AlreadyExistsEntityException, InvalidEntityException {

    Product productOut;//from  w w w.j  a v  a  2  s  .co m
    try {
        productOut = productDao.load(product.getName());
        log.log(Level.INFO, "Product " + productOut.getName() + " LOADED");
    } catch (EntityNotFoundException e) {

        List<Metadata> metadatas = new ArrayList<Metadata>();
        metadatas.add(new Metadata("image", "df44f62d-9d66-4dc5-b084-2d6c7bc4cfe4")); // centos6.3_sdc
        metadatas.add(new Metadata("cookbook_url", ""));
        metadatas.add(new Metadata("cloud", "yes"));
        metadatas.add(new Metadata("installator", "chef"));
        metadatas.add(new Metadata("open_ports", "80 22"));
        metadatas.add(new Metadata("tenant_id", tenantId));

        List<Metadata> defaultmetadatas = new ArrayList<Metadata>();
        defaultmetadatas.add(new Metadata("image", "df44f62d-9d66-4dc5-b084-2d6c7bc4cfe4"));
        defaultmetadatas.add(new Metadata("cookbook_url", ""));
        defaultmetadatas.add(new Metadata("cloud", "yes"));
        defaultmetadatas.add(new Metadata("installator", "chef"));
        defaultmetadatas.add(new Metadata("open_ports", "80 22"));
        defaultmetadatas.add(new Metadata("tenant_id", tenantId));

        for (Metadata external_metadata : product.getMetadatas()) {
            boolean defaultmetadata = false;
            for (Metadata default_metadata : defaultmetadatas) {
                if (external_metadata.getKey().equals(default_metadata.getKey())) {
                    metadatas.get(metadatas.indexOf(default_metadata)).setValue(external_metadata.getValue());
                    defaultmetadata = true;
                }
            }
            if (!defaultmetadata) {
                metadatas.add(external_metadata);
            }
        }
        product.setMetadatas(metadatas);
        productOut = productDao.create(product);
    }
    return productOut;
}

From source file:net.easysmarthouse.cameras.ws.WebcamWebSocketHandler.java

@Override
public void newImage(Webcam webcam, BufferedImage image) {
    log.log(Level.INFO, "New image from camera [{0}]", new Object[] { webcam.getDevice().getName() });

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {//  ww w.  jav a  2 s  . c o  m
        ImageIO.write(image, "JPG", baos);
    } catch (IOException e) {
        log.log(Level.SEVERE, "Error while getting the image", e);
    }

    String base64 = null;
    try {
        base64 = new String(Base64.encodeBase64(baos.toByteArray()), "UTF-8");
    } catch (UnsupportedEncodingException e) {
        log.log(Level.SEVERE, "Error while encoding", e);
    }

    Map<String, Object> message = new HashMap<String, Object>();
    message.put("type", "image");
    message.put("webcam", webcam.getName());
    message.put("image", base64);

    send(message);
}

From source file:org.archone.ad.authentication.ShoadRealm.java

@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
    if (principals == null) {
        throw new AuthorizationException("PrincipalCollection method argument cannot be null.");
    }/*from  w  w w  .j a  v a2s  . co  m*/

    String username = (String) getAvailablePrincipal(principals);

    Set<String> roleNames = null;
    SearchControls controls = new SearchControls();
    controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
    DirContextAdapter context = (DirContextAdapter) contextSource.getReadOnlyContext();
    try {
        String userDn = (String) getUserDn(username);

        DirContextAdapter superuserGroup = (DirContextAdapter) new LdapTemplate(contextSource)
                .lookup("cn=administrator,cn=shoad");
        Set<String> superusers = superuserGroup.getAttributeSortedStringSet("uniqueMember");

        Logger.getLogger("AUTH").log(Level.INFO, "THE SIZE IS {0}", new Integer(superusers.size()).toString());

        if (superusers.contains(userDn)) {
            Logger.getLogger("AUTH").log(Level.INFO, "SUPERUSER LOGGED IN");
            roleNames.add("SUPERUSER");
        }

        NamingEnumeration<SearchResult> searchResults = context.search("",
                adConfiguration.getMembershipSearchFilter(), new String[] { userDn }, controls);
        while (searchResults.hasMore()) {
            GroupDn groupDn = new GroupDn(searchResults.next().getNameInNamespace(),
                    adConfiguration.getGroupsRdn());
            roleNames.add(groupDn.getAsGroupId());
        }

    } catch (javax.naming.NamingException ex) {
        Logger.getLogger(ShoadRealm.class.getName()).log(Level.SEVERE, null, ex);
        throw new AuthorizationException(ex);
    }

    SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(roleNames);

    return info;
}

From source file:com.twitter.heron.instance.HeronInstance.java

public static void main(String[] args) throws IOException {
    CommandLine commandLine = parseCommandLineArgs(args);

    String topologyName = commandLine.getOptionValue(CommandLineOptions.TOPOLOGY_NAME_OPTION);
    String topologyId = commandLine.getOptionValue(CommandLineOptions.TOPOLOGY_ID_OPTION);
    String instanceId = commandLine.getOptionValue(CommandLineOptions.INSTANCE_ID_OPTION);
    String componentName = commandLine.getOptionValue(CommandLineOptions.COMPONENT_NAME_OPTION);
    Integer taskId = Integer.parseInt(commandLine.getOptionValue(CommandLineOptions.TASK_ID_OPTION));
    Integer componentIndex = Integer
            .parseInt(commandLine.getOptionValue(CommandLineOptions.COMPONENT_INDEX_OPTION));
    String streamId = commandLine.getOptionValue(CommandLineOptions.STMGR_ID_OPTION);
    Integer streamPort = Integer.parseInt(commandLine.getOptionValue(CommandLineOptions.STMGR_PORT_OPTION));
    Integer metricsPort = Integer
            .parseInt(commandLine.getOptionValue(CommandLineOptions.METRICS_MGR_PORT_OPTION));
    String systemConfigFile = commandLine.getOptionValue(CommandLineOptions.SYSTEM_CONFIG_FILE);
    String overrideConfigFile = commandLine.getOptionValue(CommandLineOptions.OVERRIDE_CONFIG_FILE);

    Integer remoteDebuggerPort = null;
    if (commandLine.hasOption(CommandLineOptions.REMOTE_DEBUGGER_PORT)) {
        remoteDebuggerPort = Integer
                .parseInt(commandLine.getOptionValue(CommandLineOptions.REMOTE_DEBUGGER_PORT));
    }// www. j  av  a2  s .  c  om

    SystemConfig systemConfig = SystemConfig.newBuilder(true).putAll(systemConfigFile, true)
            .putAll(overrideConfigFile, true).build();

    // Add the SystemConfig into SingletonRegistry
    SingletonRegistry.INSTANCE.registerSingleton(SystemConfig.HERON_SYSTEM_CONFIG, systemConfig);

    // Create the protobuf Instance
    PhysicalPlans.InstanceInfo.Builder instanceInfoBuilder = PhysicalPlans.InstanceInfo.newBuilder()
            .setTaskId(taskId).setComponentIndex(componentIndex).setComponentName(componentName);
    if (remoteDebuggerPort != null) {
        instanceInfoBuilder.setRemoteDebuggerPort(remoteDebuggerPort);
    }
    PhysicalPlans.InstanceInfo instanceInfo = instanceInfoBuilder.build();

    PhysicalPlans.Instance instance = PhysicalPlans.Instance.newBuilder().setInstanceId(instanceId)
            .setStmgrId(streamId).setInfo(instanceInfo).build();

    // Init the logging setting and redirect the stdout and stderr to logging
    // For now we just set the logging level as INFO; later we may accept an argument to set it.
    Level loggingLevel = Level.INFO;
    String loggingDir = systemConfig.getHeronLoggingDirectory();

    // Log to file and TMaster
    LoggingHelper.loggerInit(loggingLevel, true);
    LoggingHelper.addLoggingHandler(LoggingHelper.getFileHandler(instanceId, loggingDir, true,
            systemConfig.getHeronLoggingMaximumSize(), systemConfig.getHeronLoggingMaximumFiles()));
    LoggingHelper.addLoggingHandler(new ErrorReportLoggingHandler());

    String logMsg = "\nStarting instance " + instanceId + " for topology " + topologyName + " and topologyId "
            + topologyId + " for component " + componentName + " with taskId " + taskId + " and componentIndex "
            + componentIndex + " and streamManagerId " + streamId + " and streamManagerPort " + streamPort
            + " and metricsManagerPort " + metricsPort;

    if (remoteDebuggerPort != null) {
        logMsg += " and remoteDebuggerPort " + remoteDebuggerPort;
    }

    LOG.info(logMsg);

    LOG.info("System Config: " + systemConfig.toString());

    HeronInstance heronInstance = new HeronInstance(topologyName, topologyId, instance, streamPort,
            metricsPort);
    heronInstance.start();
}

From source file:com.skynetcomputing.connection.ConnectionMgr.java

/**
 * Save the received file in the job directory.
 *
 * @param aFile File that was send by the server.
 * @param extension Extension of the file.
 * @return True if saved./*w  w  w.ja va2s  .  c om*/
 * @throws IOException
 */
public boolean saveFileLocal(File aFile) throws IOException {
    Logger.getLogger(ConnectionMgr.class.getName()).log(Level.INFO, "File received: {0}", aFile.getName());
    String extension = FilenameUtils.getExtension(aFile.getAbsolutePath());
    switch (extension) {
    case "jar":
        workMgr.onJarReceived(aFile);
        return true;
    case "task":
        workMgr.onTaskReceived(aFile);
        return true;
    case "data":
        workMgr.onDataReceived(aFile);
        return true;
    default:
        return false;
    }
}