Example usage for java.util.logging Level FINE

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

Introduction

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

Prototype

Level FINE

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

Click Source Link

Document

FINE is a message level providing tracing information.

Usage

From source file:edu.usu.sdl.openstorefront.security.SecurityUtil.java

/**
 * Gets the current user logged in.//from   w  ww . jav a 2s  . co m
 *
 * @return the username
 */
public static String getCurrentUserName() {
    String username = OpenStorefrontConstant.ANONYMOUS_USER;
    try {
        Subject currentUser = SecurityUtils.getSubject();
        if (currentUser.getPrincipal() != null) {
            username = currentUser.getPrincipal().toString();
        }
    } catch (Exception e) {
        log.log(Level.FINE, "Determing Username.  No user is logged in.  This is likely an auto process.");
    }
    return username;
}

From source file:fr.gouv.vitam.utils.logging.CommonsLoggerFactory.java

@Override
protected void seLevelSpecific(final VitamLogLevel level) {
    // XXX FIXME does not work for Apache Commons Logger
    switch (level) {
    case TRACE:/* w  w  w.j a  v a2 s. c  o  m*/
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.FINEST);
        break;
    case DEBUG:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.FINE);
        break;
    case INFO:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.INFO);
        break;
    case WARN:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.WARNING);
        break;
    case ERROR:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.SEVERE);
        break;
    default:
        LogFactory.getFactory().setAttribute(LogFactory.PRIORITY_KEY, Level.WARNING);
        break;
    }
}

From source file:demo.service.CustomerService.java

@GET
@Path("/{id}/")
@Produces("application/json")
public Customer getCustomer(@PathParam("id") final String id) {
    Validate.notNull(id);/* w w w. j a v  a2 s  .c  o  m*/
    Validate.notEmpty(id);

    LOGGER.log(Level.FINE, "Invoking getCustomer, id={0}", id);

    Customer customer = customers.get(Long.parseLong(id));

    if (customer == null) {
        LOGGER.log(Level.SEVERE, "Specified customer does not exist, id={0}", id);
    }

    return customer;
}

From source file:eu.trentorise.opendata.commons.test.jackson.OdtJacksonTester.java

/**
* Converts {@code obj} to an {@link ObjectNode}, sets field
* {@code fieldName} to {@code newNode} and returns the json string
* representation of such new object. Also logs the json with the provided logger at FINE
* level./*from   w  w w .  j a v  a2s.  c  o m*/
*/
public static String changeField(ObjectMapper objectMapper, Logger logger, Object obj, String fieldName,
        JsonNode newNode) {
    checkNotNull(obj);
    checkNotEmpty(fieldName, "Invalid field name!");

    String string;
    try {
        string = objectMapper.writeValueAsString(obj);
    } catch (JsonProcessingException ex) {
        throw new RuntimeException("Error while jacksonizing object to json node!", ex);
    }
    TreeNode treeNode;
    try {
        treeNode = (ObjectNode) objectMapper.readTree(string);
    } catch (IOException ex) {
        throw new RuntimeException("Error while creating json tree from serialized object:" + string, ex);
    }
    if (!treeNode.isObject()) {
        throw new OdtException(
                "The provided object was jacksonized to a string which does not represent a JSON object! String is "
                        + string);
    }
    ObjectNode jo = (ObjectNode) treeNode;
    jo.put(fieldName, newNode);

    String json = jo.toString();

    logger.log(Level.FINE, "converted json = {0}", json);

    return json;

}

From source file:eu.trentorise.opendata.commons.test.jackson.TodJacksonTester.java

/**
 * Converts {@code obj} to an {@link ObjectNode}, sets field
 * {@code fieldName} to {@code newNode} and returns the json string
 * representation of such new object. Also logs the json with the provided
 * logger at FINE level.//  w w w  .j a  va2  s  .c o m
 */
public static String changeField(ObjectMapper objectMapper, Logger logger, Object obj, String fieldName,
        JsonNode newNode) {
    checkNotNull(obj);
    checkNotEmpty(fieldName, "Invalid field name!");

    String string;
    try {
        string = objectMapper.writeValueAsString(obj);
    } catch (JsonProcessingException ex) {
        throw new RuntimeException("Error while jacksonizing object to json node!", ex);
    }
    TreeNode treeNode;
    try {
        treeNode = (ObjectNode) objectMapper.readTree(string);
    } catch (IOException ex) {
        throw new RuntimeException("Error while creating json tree from serialized object:" + string, ex);
    }
    if (!treeNode.isObject()) {
        throw new TodException(
                "The provided object was jacksonized to a string which does not represent a JSON object! String is "
                        + string);
    }
    ObjectNode jo = (ObjectNode) treeNode;
    jo.put(fieldName, newNode);

    String json = jo.toString();

    logger.log(Level.FINE, "converted json = {0}", json);

    return json;

}

From source file:io.trivium.anystore.StoreUtils.java

public static void createIfNotExists(String url) {
    Logger logger = Logger.getLogger(StoreUtils.class.getName());
    File m = new File(url);
    if (!m.exists()) {
        m.mkdirs();//from   ww w  .  j a  v a  2  s  .  c  om
        logger.log(Level.FINE, "creating directory {}", url);
    }
}

From source file:org.gameontext.regsvc.db.RatingDocuments.java

/**
 * Rate a room for an event//from w  w  w . ja v  a 2 s  . c om
 */
public void rateRoom(Rating rating) {
    Log.mapOperations(Level.FINE, this, "Add new rating: {0}", rating);

    try {
        System.out.println("Rating room : " + mapper.writeValueAsString(rating));
    } catch (JsonProcessingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    try {
        db.create(rating);
    } catch (UpdateConflictException ex) {
        // If there is a conflict, update with the new rating
        db.update(rating);
    }
}

From source file:net.openhft.chronicle.logger.jul.JulTestBase.java

protected static void log(Logger logger, ChronicleLogLevel level, String fmt, Object... args) {
    switch (level) {
    case TRACE:/*from w  w w  .  j  a  v a 2s.com*/
        logger.log(Level.ALL, fmt, args);
        break;
    case DEBUG:
        logger.log(Level.FINE, fmt, args);
        break;
    case INFO:
        logger.log(Level.INFO, fmt, args);
        break;
    case WARN:
        logger.log(Level.WARNING, fmt, args);
        break;
    case ERROR:
        logger.log(Level.SEVERE, fmt, args);
        break;
    default:
        throw new UnsupportedOperationException();
    }
}

From source file:com.marvelution.hudson.plugins.apiv2.dozer.utils.HudsonDozerClassLoader.java

/**
 * {@inheritDoc}/*from   ww w  . j  a v a 2 s.  c om*/
 */
@Override
public URL loadResource(String uri) {
    LOGGER.log(Level.FINE, "Trying to load Resource: " + uri);
    return HudsonPluginUtils.getPluginClassloader().getResource(uri);
}

From source file:ioc.wiki.processingmanager.http.HttpFileSender.java

/**
 * Afegeix la imatge i el seu nom./*from   w w  w .  java  2s .  c  om*/
 * @param destFilename nom de la imatge amb extensio
 * @param image bytes de la imatge
 */
public void setImageToSend(String destFilename, byte[] image) {
    Logger.getLogger("HttpFileSender").log(Level.FINE, "setImageToSend(" + destFilename + ", byte[] image)");
    this.destFilename = destFilename;
    this.image = image;
}