Ignore:
Timestamp:
2017-09-12T17:19:04+12:00 (7 years ago)
Author:
rmw36
Message:

Macronizer changes: 1. adding an ethical disclaimer to the main web page (temporarily still in English for the Maori jsp file too, but Te Taka will be translating this.) 2. Adding more logging to the macronizer. This required setting up a log4j.properties file (and adding its jar file copied from GS3), and modifying the existing java code DirectInput and FileUpload to make calls to logger. Modifications to build.xml to copy the new template log4j.properties.in file into web/WEB-INF/classes where the log4j.props needs to live. 3. Corrected the svn mime-type property on build.xml so that it's no longer mistaken for a binary file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/the-macronizer/trunk/src/java/web/servlets/DirectInput.java

    r30061 r31962  
    2323import monogram.plugin.PluginConfiguration;
    2424import monogram.plugin.PluginManager;
     25import org.apache.log4j.*;
    2526
    2627/**
     
    3233    private final String UNEXPECTED_ERROR = "An unexpected error has occurred. Please try again or contact the web administrator if the problem persists.";
    3334    private final String UTF8_ENCODING = "utf-8";
    34     public static boolean DI; // This will be used in a test in the mongramRestorer to add html to highligth the changes on the webpage output.
     35    public static boolean DI; // This will be used in a test in the mongramRestorer to add html to highlight the changes on the webpage output.
    3536    private File tmpdir;
     37    //Create an instance of the Logger object created for this class in log4j.properties
     38    static Logger logger = Logger.getLogger(web.servlets.DirectInput.class.getName());
    3639
    3740    @Override
     
    8689        File file = File.createTempFile("mi-tmp-", ".txt", tmpdir);
    8790        write(file, "utf-8", fragment);
    88 
     91       
    8992        //Create a fileview
    9093        PluginConfiguration configuration = new PluginConfiguration();
     
    107110            RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(path + "/main.jsp");
    108111            dispatcher.forward(request, response);
     112        //Generate an "info" level logger message including the input('fragment') and output('restoredFragment')
     113        logger.info("Input:"+fragment+"Output: "+restoredFragment);
    109114        } catch (Exception e) {
    110115           request.setAttribute("errorMessage", UNEXPECTED_ERROR);
    111116           forward(path + "/error.jsp", request, response);
    112117        } finally {
    113             file.delete();
    114         if (restoredFile != null) {
    115         restoredFile.delete();
    116         }
     118    file.delete();
     119      if (restoredFile != null) {
     120        restoredFile.delete();
     121      }
    117122        }
    118123    }
Note: See TracChangeset for help on using the changeset viewer.