comparison webapp/WEB-INF/src/HumanEchoServlet.java @ 16:33d7bd3c0990

Adding logging capabilities with log4j to the servlet; adding the log4j 1.2 class as well
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 04 Dec 2013 19:48:02 +0000
parents 08262829d456
children 00cae11c09bd
comparison
equal deleted inserted replaced
15:08262829d456 16:33d7bd3c0990
1 /*
2 * Classname
3 *
4 * Version information
5 *
6 * 3 December 2013
7 *
8 * Copyright notice
9 */
1 10
2 import java.util.Properties; 11 import java.util.Properties;
3 import java.io.IOException; 12 import java.io.IOException;
13
14 import org.apache.log4j.*;
4 15
5 import javax.servlet.http.HttpServlet; 16 import javax.servlet.http.HttpServlet;
6 import javax.servlet.http.HttpServletRequest; 17 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse; 18 import javax.servlet.http.HttpServletResponse;
8 import javax.servlet.ServletException; 19 import javax.servlet.ServletException;
16 27
17 import uk.ac.soton.isvr.*; 28 import uk.ac.soton.isvr.*;
18 29
19 public class HumanEchoServlet extends HttpServlet { 30 public class HumanEchoServlet extends HttpServlet {
20 private HumanEcho echo; 31 private HumanEcho echo;
32
33 private static Logger logger = Logger.getLogger(HumanEchoServlet.class);
21 34
22 public void init(ServletConfig config) throws ServletException { 35 public void init(ServletConfig config) throws ServletException {
23 super.init(config); 36 super.init(config);
24 37
25 // reading properties file 38 // reading properties file
58 MWStructArray Input = null; 71 MWStructArray Input = null;
59 HumanEcho echo; 72 HumanEcho echo;
60 73
61 try { 74 try {
62 echo = new HumanEcho(); 75 echo = new HumanEcho();
76
77 logger.error("We are logging!");
63 78
64 // Matlab structure: 79 // Matlab structure:
65 // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav') 80 // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav')
66 81
67 String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"}; 82 String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"};