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.app.inventario.logica.ProveedorLogicaImpl.java

@Transactional
public void guardar(Proveedor proveedor) throws Exception {
    try {//from   w  ww  .  jav  a 2 s. c  o  m
        proveedorDAO.guardar(proveedor);
    } catch (HibernateException he) {
        Logger.getLogger(ProveedorLogicaImpl.class.getName()).log(Level.SEVERE, null, he);
        throw he;
    }
}

From source file:com.ut.healthelink.jobs.MoveRhapsodyFiles.java

@Override
public void execute(JobExecutionContext context) throws JobExecutionException {

    try {/* w ww  .  j av a 2 s.  c o m*/
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
        transactionInManager.moveRhapsodyFiles();
    } catch (Exception ex) {
        try {
            throw new Exception("Error occurred trying to move Rhapsody files from schedule task", ex);
        } catch (Exception ex1) {
            Logger.getLogger(MoveRhapsodyFiles.class.getName()).log(Level.SEVERE, null, ex1);
        }
    }

}

From source file:edu.pitt.sis.infsci2730.finalProject.web.shoppingBagController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView mypage(HttpSession session) {
    try {//from w  ww.j  a va 2s  .  c o m
        CustomerDBModel customer = (CustomerDBModel) session.getAttribute("customer");
        if (customer == null) {
            return new ModelAndView("index");
        } else {
            return new ModelAndView("shoppingBag", "customer", customer);
        }
    } catch (Exception ex) {
        Logger.getLogger(OrderHistoryController.class.getName()).log(Level.SEVERE, null, ex);
        return new ModelAndView("500");
    }
}

From source file:net.hgw4.hal.SerialProtocol.java

public SerialProtocol(int num) {
    serialProtocolLogger = Logger.getLogger(SerialProtocol.class.getName());
    serialProtocolLogger.setLevel(Level.ALL);
    if (serialProtocolLogger.isLoggable(Level.INFO)) {
        serialProtocolLogger.info("SerialProtocol ");
    }//  www.j a  v  a  2 s  .com
    protocolNumber = num;
}

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

public static void cleanQueue() {
    Logger logger = Logger.getLogger(StoreUtils.class.getName());
    logger.info("cleaning queue storage");
    String path = Central.getProperty("basePath");
    if (!path.endsWith(File.separator))
        path += File.separator;/*from w  w  w . java2s.c o  m*/
    try {
        File f = new File(path + "queues" + File.separator);
        if (f.exists())
            FileUtils.deleteQuietly(f);
    } catch (Exception e1) {
        logger.log(Level.SEVERE, "cleaning queue storage failed", e1);
    }
}

From source file:com.ut.healthelink.jobs.generateOutputFiles.java

@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
    try {/*from   w w  w .j  a v  a 2 s  .  c o  m*/
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);

        transactionOutManager.generateOutputFiles();
    } catch (Exception ex) {
        try {
            throw new Exception("Error occurred trying to generate output files from schedule task", ex);
        } catch (Exception ex1) {
            Logger.getLogger(generateOutputFiles.class.getName()).log(Level.SEVERE, null, ex1);
        }
    }

}

From source file:com.screenslicer.common.Log.java

public static void init(String loggerName, boolean allowFileLogging) {
    logger = Logger.getLogger(loggerName);
    if (allowFileLogging) {
        FileHandler fh = null;//  www  .j  a  va 2  s  . c om
        try {
            fh = new FileHandler("../" + loggerName + ".log", 250000, 9, true);
            logger.addHandler(fh);
            String logLevel = System.getProperty("screenslicer-logging", "prod");
            if (logLevel.equals("prod")) {
                logger.setLevel(Level.INFO);
            } else if (logLevel.equals("debug")) {
                logger.setLevel(Level.ALL);
            }
            SimpleFormatter formatter = new SimpleFormatter();
            fh.setFormatter(formatter);
        } catch (Throwable t) {
            t.printStackTrace();
            throw new RuntimeException(t);
        }
    }
}

From source file:monitor.api.Requests.java

/**
 * Send HTTP requistion to get token to access OpenStack.
 * @param jsonCredentials security informations (user and password) of OpenStack.
 * @return response of HTTP requisition (JSON)
 *//*  w ww.  j a v a 2s  . co m*/
public HttpResponse<JsonNode> requestToken(String jsonCredentials) {
    URL url = new URL();
    try {
        return Unirest.post(url.getIdentityTokens()).header("Content-Type", "application/json")
                .body(jsonCredentials).asJson();
    } catch (UnirestException ex) {
        Logger.getLogger(Requests.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}

From source file:pl.p.lodz.ftims.server.logic.ChallengeServiceTest.java

@AfterClass
public static void deleteImgDir() throws IOException {
    Stream<Path> stream = Files.list(Paths.get(PHOTOS_DIR));
    stream.forEach((Path p) -> {
        try {/*  ww w. j  a  va 2  s.  c  o  m*/
            Files.delete(p);
        } catch (IOException ex) {
            Logger.getLogger(ChallengeServiceTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    Files.deleteIfExists(Paths.get(PHOTOS_DIR));
}

From source file:it.cnr.ilc.ilcioutils.IlcInputToFile.java

/**
 * Creates a file with the content read from string
 * @param string the String with the content is
 * @return a File with the content from the URL
 *///from   w ww  .j a  va2s .  com
public static File createAndWriteTempFileFromString(String string) {
    File tempOutputFile = null;
    String encoding = "UTF-8";
    String message;
    try {
        tempOutputFile = File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX);
        FileUtils.writeStringToFile(tempOutputFile, string, encoding);

    } catch (IOException e) {
        message = String.format("Error in accessing String %s %s", string, e.getMessage());
        Logger.getLogger(CLASS_NAME).log(Level.SEVERE, message);
    }
    return tempOutputFile;

}