Code example for Logger

Methods: info, severe

0
		return (url.toString() + "/validate.faces");
	} 
 
	private boolean saveUserObject(String uuid)
	{ 
		log.info("SAVE USER");
		log.info(user.getUsername());
			 
		if (!cachedir.exists()) {
			if (!cachedir.mkdirs()) {
				log.severe("failed to create caching dir: " + cachedir);
				return false; 
			} 
		} 
 
		try  
		{ 
			File userfile = new File(cachedir, uuid);
			userfile.deleteOnExit();
			FileOutputStream stream = new FileOutputStream(userfile);
			BufferedOutputStream buffer = new BufferedOutputStream(stream);
			ObjectOutputStream objOut = new ObjectOutputStream(buffer);
			objOut.writeObject(user);
			objOut.close();
			log.info("Saved user details to "  + userfile);
		} 
		catch(Exception e)
		{ 
			e.printStackTrace();
			return false; 
		} 
		return true; 
	} 
 
	/** 
	 * Method to save the user details 
	 *  
	 * @return	An outcome string for use in navigation 
	 * 			saved - user was successfully saved 
	 *  
	 * @throws	NoSuchAlgorithmException 
	 * @throws  UserNotFoundException 
	 */ 
	public String signup() throws NoSuchAlgorithmException 
	{ 
		this.user.hashPassword(password);
		String uuid = UUID.randomUUID().toString();
		if(!saveUserObject(uuid))
			return "error"; 
 
		String subject = "Confirm your PLANETS user account";
		String body = "Please click on the following link to validate your PLANETS user account\n";
		body += getValidationURL() + "?uid="+uuid;
		 
		log.info("Sending email to: " + user.getEmail());
		log.info("Subject: " + subject);
		log.info(body);
 
		PlanetsMailMessage mailer = new PlanetsMailMessage();
                mailer.setSubject(subject);
                mailer.setBody(body);
                mailer.addRecipient(user.getEmail());