Index: murachi/src/main/java/ve/gob/cenditel/murachi/MurachiRESTWS.java
===================================================================
--- murachi/src/main/java/ve/gob/cenditel/murachi/MurachiRESTWS.java	(revision 4ac0cf427c691a11a245d4915c8337d77f277bcc)
+++ murachi/src/main/java/ve/gob/cenditel/murachi/MurachiRESTWS.java	(revision 81c864a8dd99434382e64f89b7fd715eb107012e)
@@ -116,5 +116,6 @@
 public class MurachiRESTWS {
 	
-	static Logger logger = Logger.getLogger(MurachiRESTWS.class);
+	final static Logger logger = Logger.getLogger(MurachiRESTWS.class);
+	
 
 	private static final String API_VERSION = "0.1.0";
@@ -148,4 +149,5 @@
 	@Produces(MediaType.TEXT_HTML)
 	public String returnVersion() {
+		logger.info("/version: Murachi Version: " + API_VERSION);
 		return "<p>Murachi Version: " + API_VERSION + "</p>";
 	}
@@ -168,7 +170,9 @@
 			@FormDataParam("upload") FormDataContentDisposition fileDetails) throws MurachiException {
 		
-		//TODO manejar las excepciones correctamente
+		logger.info("/: uploadFile");
+		
 		if (uploadedInputStream == null) {
 			System.out.println("uploadedInputStream == null");
+			logger.error("uploadedInputStream != null. datos recibidos del formulario son nulos.");
 			throw new MurachiException("uploadedInputStream != null. datos recibidos del formulario son nulos.");
 		}
@@ -176,4 +180,5 @@
 		if (fileDetails == null) {
 			System.out.println("fileDetails == null");
+			logger.error("fileDetails == null. datos recibidos del formulario son nulos.");
 			throw new MurachiException("fileDetails == null. datos recibidos del formulario son nulos.");
 		}
@@ -187,4 +192,5 @@
 			uploadedInputStream.close();
 		} catch (IOException e) {
+			logger.error("Ocurrio una excepcion: ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
@@ -196,4 +202,5 @@
 		System.out.println("File saved to server location : " + SERVER_UPLOAD_LOCATION_FOLDER + fileId);
 		String result = jsonObject.toString();
+		logger.info("/: " + result);
 		
 		return Response.status(200).entity(result).build();
@@ -209,4 +216,5 @@
 	@Produces(MediaType.APPLICATION_OCTET_STREAM)
 	public Response downloadFilebyPath(@PathParam("filename")  String fileName) {
+		logger.info("/descargas/{"+fileName+"}");
 		return downloadFileFromServer(fileName);
 	}
@@ -266,6 +274,9 @@
 			@FormDataParam("upload") FormDataContentDisposition fileDetails) throws MurachiException {
 		
+		logger.info("/firmados: uploadFileAndVerify");
+		
 		if (uploadedInputStream == null) {
 			System.out.println("uploadedInputStream == null");
+			logger.error("uploadedInputStream != null. datos recibidos del formulario son nulos.");
 			throw new MurachiException("uploadedInputStream != null. datos recibidos del formulario son nulos.");
 		}
@@ -273,4 +284,5 @@
 		if (fileDetails == null) {
 			System.out.println("fileDetails == null");
+			logger.error("fileDetails == null. datos recibidos del formulario son nulos.");
 			throw new MurachiException("fileDetails == null. datos recibidos del formulario son nulos.");
 		}
@@ -284,4 +296,5 @@
 			uploadedInputStream.close();
 		} catch (IOException e) {
+			logger.error("Ocurrio una excepcion: ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
@@ -293,4 +306,5 @@
 					
 		jsonObject = verifyALocalFile(fileId);
+		logger.info("/firmados: " + jsonObject.toString());
 		
 		return Response.status(200).entity(jsonObject.toString()).build();
@@ -309,4 +323,5 @@
 		
 		System.out.println("uploadedFileLocation: " + uploadedFileLocation);
+		logger.debug("uploadedFileLocation: " + uploadedFileLocation);
 		
 		try {
@@ -324,4 +339,5 @@
 		}
 		catch(IOException e) {
+			logger.error("saveToDisk: ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
@@ -341,8 +357,8 @@
 	@Produces("application/json")
 	public Response verifyAFile(@PathParam("idFile") String idFile) throws MurachiException {
-/*		
+
 		System.out.println("/{idFile}");
-		
-		String result = "";
+		logger.info("/{"+idFile+"}");
+		
 		String file = SERVER_UPLOAD_LOCATION_FOLDER + idFile;
 		
@@ -354,39 +370,5 @@
 			System.out.println("File : " + file + " does not exists.");
 			jsonObject.put("fileExist", "false");
-			
-		}else{
-			System.out.println("File : " + file + " exists.");
-			jsonObject.put("fileExist", "true");
-			
-			String mime = getMimeType(file);
-			System.out.println("mimetype : " + mime);
-			
-			if (mime.equals("application/pdf")){
-				System.out.println(" PDF ");
-				
-				jsonObject = verifySignaturesInPdf(file);
-				
-			}else{
-				System.out.println("BDOC");
-				//jsonObject.put("formato", "BDOC");
-				//jsonObject.put("resultado", "NO IMPLEMENTADO");
-				
-				jsonObject = verifySignaturesInBdoc(file);
-			}			
-		}
-		result = jsonObject.toString();
-		return Response.status(200).entity(result).build();
-*/
-		System.out.println("/{idFile}");
-		
-		String file = SERVER_UPLOAD_LOCATION_FOLDER + idFile;
-		
-		File tmpFile = new File(file);
-		
-		JSONObject jsonObject = new JSONObject();
-		
-		if (!tmpFile.exists()) {
-			System.out.println("File : " + file + " does not exists.");
-			jsonObject.put("fileExist", "false");
+			logger.debug("fileExist: false");
 			
 		}else{
@@ -412,11 +394,12 @@
 				System.out.println("extension no reconocida");
 				jsonObject.put("fileExist", "true");
-				jsonObject.put("error", "extension not supported");				
+				jsonObject.put("error", "extension not supported");
+				logger.debug("error: extension not supported");
 			}
 		}
 		String result = jsonObject.toString();
+		logger.info("/{"+idFile+"}: result");
 		return Response.status(200).entity(result).build();
-		
-		
+				
 	}
 	
@@ -432,4 +415,5 @@
 		
 		System.out.println("verifyALocalFile: " + idFile);
+		logger.debug("verifyALocalFile: " + idFile);
 		
 		String file = SERVER_UPLOAD_LOCATION_FOLDER + idFile;
@@ -442,4 +426,5 @@
 			System.out.println("File : " + file + " does not exists.");
 			jsonObject.put("fileExist", "false");
+			logger.debug("fileExist: false");
 			
 		}else{
@@ -465,5 +450,6 @@
 				System.out.println("extension no reconocida");
 				jsonObject.put("fileExist", "true");
-				jsonObject.put("error", "extension not supported");				
+				jsonObject.put("error", "extension not supported");	
+				logger.debug("error: extension not supported");
 			}
 		}
@@ -479,4 +465,6 @@
 	 */
 	private JSONObject verifySignaturesInPdf(String pdfFile) throws MurachiException {
+		
+		logger.debug("verifySignaturesInPdf: "+ pdfFile);
 		
 		JSONObject jsonSignatures = new JSONObject();
@@ -513,8 +501,10 @@
 			}
 			
-		} catch (IOException e) {		
+		} catch (IOException e) {
+			logger.error("verifySignaturesInPdf ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (GeneralSecurityException e) {
+			logger.error("verifySignaturesInPdf ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
@@ -533,6 +523,8 @@
 	 * @throws MurachiException 
 	 */
-	public HashMap<String, String> verifySignature(AcroFields fields, String name) throws GeneralSecurityException, IOException, MurachiException {
-				
+	public HashMap<String, String> verifySignature(AcroFields fields, String name) 
+			throws GeneralSecurityException, IOException, MurachiException {
+			
+		logger.debug("verifySignature()");
 		HashMap<String, String> integrityMap = new HashMap<String, String>();
 		
@@ -651,4 +643,5 @@
 	public JSONObject getJSONFromASignature(HashMap<String, String> hashMap) {
 		
+		logger.debug("getJSONFromASignature()");
 		JSONObject jsonSignature = new JSONObject();
 		
@@ -667,5 +660,5 @@
 	 */
 	private KeyStore setupKeyStore() throws MurachiException {
-		
+		logger.debug("setupKeyStore()");
 		KeyStore ks = null;
 		try {
@@ -679,14 +672,18 @@
 			
 			
-		} catch (KeyStoreException e) {			
+		} catch (KeyStoreException e) {	
+			logger.error("setupKeyStore() ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (NoSuchAlgorithmException e) {
+			logger.error("setupKeyStore() ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (CertificateException e) {
+			logger.error("setupKeyStore() ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (IOException e) {
+			logger.error("setupKeyStore() ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
@@ -700,7 +697,8 @@
 	 * @param signDate fecha en que se realizo la firma
 	 * @return informacion del certificado firmante de una revision en forma de HashMap
-	 */
-	public HashMap<String, String> getSignerCertificateInfo(X509Certificate cert, Date signDate) {
-		
+	 * @throws MurachiException 
+	 */
+	public HashMap<String, String> getSignerCertificateInfo(X509Certificate cert, Date signDate) throws MurachiException {
+		logger.debug("getSignerCertificateInfo()");
 		HashMap<String, String> signerCertificateMap = new HashMap<String, String>();
 		
@@ -728,8 +726,12 @@
 					.println("The certificate was expired at the time of signing.");
 			signerCertificateMap.put("signerCertificateExpiredAtTimeOfSigning", "true");
+			logger.error("getSignerCertificateInfo() ocurrio una excepcion: The certificate was expired at the time of signing");
+			throw new MurachiException(e.getMessage());
 		} catch (CertificateNotYetValidException e) {
 			System.out
 					.println("The certificate wasn't valid yet at the time of signing.");
 			signerCertificateMap.put("signerCertificateNotValidYetAtTimeOfSigning", "true");
+			logger.error("getSignerCertificateInfo() ocurrio una excepcion: The certificate wasn't valid yet at the time of signing");
+			throw new MurachiException(e.getMessage());
 		}
 		try {
@@ -740,7 +742,11 @@
 			System.out.println("The certificate has expired.");
 			signerCertificateMap.put("signerCertificateHasExpired", "true");
+			logger.error("getSignerCertificateInfo() ocurrio una excepcion: The certificate has expired");
+			throw new MurachiException(e.getMessage());
 		} catch (CertificateNotYetValidException e) {
 			System.out.println("The certificate isn't valid yet.");
 			signerCertificateMap.put("signerCertificateNotValidYet", "true");
+			logger.error("getSignerCertificateInfo() ocurrio una excepcion: The certificate isn't valid yet");
+			throw new MurachiException(e.getMessage());
 		}
 		return signerCertificateMap;
@@ -775,4 +781,6 @@
 	public Response presignPdf(PresignParameters presignPar, @Context HttpServletRequest req) throws MurachiException {
 		
+		logger.info("/pdfs");
+		
 		PresignHash presignHash = new PresignHash();
 
@@ -793,4 +801,5 @@
 		String pdf = SERVER_UPLOAD_LOCATION_FOLDER + fileId;
 		System.out.println("archivo a firmar: " + pdf);
+		logger.debug("archivo a firmar: " + pdf);
 		
 		String mime = getMimeType(pdf);
@@ -802,4 +811,5 @@
 									
 			//result = presignHash.toString();
+			logger.info("El archivo que desea firmar no es un PDF.");
 			return Response.status(400).entity(presignHash).build();
 			
@@ -816,8 +826,12 @@
 			if (chain[0] == null) {
 				System.out.println("error chain[0] == null");
+				logger.error("presignPdf: error en carga de certificado de firmante");
+				throw new MurachiException("presignPdf: error en carga de certificado de firmante");
 			}else {
 				
 				System.out.println("se cargo el certificado correctamente");
 				System.out.println(chain[0].toString());
+				logger.debug("se cargo el certificado correctamente");
+				logger.debug(chain[0].toString());
 			}			
 			
@@ -892,6 +906,9 @@
 	    	
 	    	System.out.println("sh length: "+ sh.length);
+	    	logger.debug("sh length: "+ sh.length);
 	    	    	
 	    	String hashToSign = byteArrayToHexString(sh);
+	    	logger.debug("hashToSign: "+ hashToSign);
+	    	logger.debug("length: " +hashToSign.length());
 	    	System.out.println("***************************************************************");
 	    	System.out.println("HASH EN HEXADECIMAL:");
@@ -923,30 +940,39 @@
 			
 		} catch (CertificateException e1) {
+			logger.error("presignPdf ocurrio una excepcion ", e1);
 			e1.printStackTrace();
 			throw new MurachiException(e1.getMessage());
 		} catch (InvalidPdfException e) {
+			logger.error("presignPdf ocurrio una excepcion ", e);
 			e.printStackTrace();
 			presignHash.setError("No se pudo leer el archivo PDF en el servidor");
 			throw new MurachiException(e.getMessage());
 		} catch (IOException e) {
+			logger.error("presignPdf ocurrio una excepcion ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (DocumentException e) {
+			logger.error("presignPdf ocurrio una excepcion ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (InvalidKeyException e) {
+			logger.error("presignPdf ocurrio una excepcion ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (NoSuchProviderException e) {
+			logger.error("presignPdf ocurrio una excepcion ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (NoSuchAlgorithmException e) {
+			logger.error("presignPdf ocurrio una excepcion ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} catch (GeneralSecurityException e) {
+			logger.error("presignPdf ocurrio una excepcion ", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
 		} 
 		
+		logger.debug("presignPdf: "+ presignHash.toString());
 		return Response.status(200).entity(presignHash).build();
 		//return presignHash;
@@ -962,4 +988,6 @@
 	 */
 	private Boolean pdfAlreadySigned(PdfReader pdfReader) throws IOException {
+		
+		logger.debug("pdfAlreadySigned()");
 		Security.addProvider(new BouncyCastleProvider());
 		
@@ -979,4 +1007,5 @@
 	 */
 	private int numberOfSignatures(PdfReader pdfReader) {
+		logger.debug("numberOfSignatures()");
 		Security.addProvider(new BouncyCastleProvider());
 		
@@ -1002,5 +1031,5 @@
 	public Response postsignPdf(PostsignParameters postsignPar, @Context HttpServletRequest req) throws IOException, MurachiException {
 		
-				
+		logger.info("/pdfs/resenas");
 		// cadena con la firma
 		String signature = postsignPar.getSignature();
@@ -1011,4 +1040,5 @@
 		String fileId = (String) session.getAttribute("fileId");
 		System.out.println("fileId: " + fileId);
+		logger.debug("fileId: " + fileId);
 		
 		PdfStamper stamper = (PdfStamper) session.getAttribute("stamper");
@@ -1026,20 +1056,25 @@
 		if (sgn == null) {
 			System.out.println("sgn == null");
+			logger.error("Error en completacion de firma: estructura PdfPKCS7 nula");
 			throw new MurachiException("Error en completacion de firma: estructura PdfPKCS7 nula");
 		}
 		if (hash == null) {
 			System.out.println("hash == null");
+			logger.error("Error en completacion de firma: hash nulo");
 			throw new MurachiException("Error en completacion de firma: hash nulo");
 		}
 		if (cal == null) {
 			System.out.println("cal == null");
+			logger.error("Error en completacion de firma: estructura de fecha nula");
 			throw new MurachiException("Error en completacion de firma: estructura de fecha nula");
 		}
 		if (sap == null) {
 			System.out.println("sap == null");
+			logger.error("Error en completacion de firma: estructura de apariencia de firma pdf nula");
 			throw new MurachiException("Error en completacion de firma: estructura de apariencia de firma pdf nula");
 		}
 		if (os == null) {
 			System.out.println("os == null");
+			logger.error("Error en completacion de firma: bytes de archivo nulos");
 			throw new MurachiException("Error en completacion de firma: bytes de archivo nulos");
 		}
@@ -1064,8 +1099,10 @@
 		}catch(DocumentException e) {
 			System.out.println("throw new IOException");
+			logger.error("postsignPdf: ocurrio una excepcion", e);
 			throw new MurachiException(e.getMessage());
 			
 		} catch (IOException e) {
 			System.out.println("IOException e");
+			logger.error("postsignPdf: ocurrio una excepcion", e);
 			e.printStackTrace();
 			throw new MurachiException(e.getMessage());
@@ -1083,4 +1120,5 @@
 		// SERVER_UPLOAD_LOCATION_FOLDER + fileId;		
 		System.out.println("Archivo firmado correctamente");
+		logger.debug("Archivo firmado correctamente");
 			
 		PostsignMessage message = new PostsignMessage();
@@ -1091,4 +1129,6 @@
 		JSONObject jsonFinalResult = new JSONObject();
 		jsonFinalResult.put("signedFileId",fileId + "-signed.pdf");
+		
+		logger.info(jsonFinalResult.toString());
 		return Response.status(200).entity(jsonFinalResult.toString()).build();
 	}
@@ -1102,4 +1142,5 @@
 	@Path("/pdfs/{idFile}")
 	public Response getPdfSigned(@PathParam("idFile") String idFile) {
+		logger.info("/pdfs/{idFile}");
 		File file = null;
 		
Index: murachi/src/main/resources/log4j.properties
===================================================================
--- murachi/src/main/resources/log4j.properties	(revision 81c864a8dd99434382e64f89b7fd715eb107012e)
+++ murachi/src/main/resources/log4j.properties	(revision 81c864a8dd99434382e64f89b7fd715eb107012e)
@@ -0,0 +1,16 @@
+# Root logger option
+log4j.rootLogger=DEBUG, stdout, file
+ 
+# Redirect log messages to console
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+ 
+# Redirect log messages to a log file, support file rolling.
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=/tmp/MurachiRESTWS.log
+log4j.appender.file.MaxFileSize=5MB
+log4j.appender.file.MaxBackupIndex=10
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
