Ignore:
Timestamp:
06/26/13 15:30:58 (11 years ago)
Author:
pharms
Message:
  • changed log file directory structure for better distinguishing the monitored applications
  • extended session timeout to potentially reduce log file sizes
  • increased log file maximum sizes to reduce storage consumption due do GUI model duplication
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorOutputWriter.java

    r1089 r1227  
    5151     * the maximum size of an individual log file 
    5252     */ 
    53     private static final int MAXIMUM_LOG_FILE_SIZE = 10000000; 
     53    private static final int MAXIMUM_LOG_FILE_SIZE = 50000000; 
    5454 
    5555    /** 
     
    6262     */ 
    6363    private File logFileBaseDir; 
     64 
     65    /** 
     66     * the id of the web application used by the client 
     67     */ 
     68    private String webAppId; 
    6469 
    6570    /** 
     
    97102     * @param logFileBaseDir the log file base directory, or null if the default directory shall 
    98103     *                       be taken 
     104     * @param webAppId       the ID of the web application used by the client 
    99105     * @param clientId       the ID of the client, for which this writer logs 
    100106     */ 
    101     public HtmlMonitorOutputWriter(String logFileBaseDir, String clientId) { 
     107    public HtmlMonitorOutputWriter(String logFileBaseDir, String webAppId, String clientId) { 
    102108        if (logFileBaseDir == null) { 
    103109            this.logFileBaseDir = new File(DEFAULT_LOG_FILE_BASE_DIR); 
     
    107113        } 
    108114         
     115        this.webAppId = webAppId; 
    109116        this.clientId = clientId; 
    110117         
     
    123130        synchronized (HtmlMonitorOutputWriter.class) { 
    124131            try { 
    125                 File clientLogDir = new File(logFileBaseDir, clientId); 
    126              
     132                File clientLogDir = new File(logFileBaseDir, webAppId); 
     133                clientLogDir = new File(clientLogDir, clientId); 
     134                 
    127135                if (!clientLogDir.exists()) { 
    128136                    if (!clientLogDir.mkdirs()) { 
     
    136144                } 
    137145                 
     146                handleOldLogFiles(new File(logFileBaseDir, clientId), clientLogDir); 
     147                 
    138148                logFile = new File(clientLogDir, getLogFileName(-1)); 
    139149                 
     
    318328        } 
    319329        else { 
    320             val = value.toString(); 
     330            val = String.valueOf(value); 
    321331        } 
    322332         
     
    399409    } 
    400410 
     411    /** 
     412     * <p> 
     413     * this method moves old logfiles of the same client resisting in the wrong old directory 
     414     * structure to the new one. 
     415     * </p> 
     416     * 
     417     * @param file 
     418     * @param clientLogDir 
     419     */ 
     420    private void handleOldLogFiles(File oldLogDir, File newLogDir) { 
     421        if (oldLogDir.exists() && oldLogDir.isDirectory()) { 
     422            for (File oldLogFile : oldLogDir.listFiles()) { 
     423                oldLogFile.renameTo(new File(newLogDir, oldLogFile.getName())); 
     424            } 
     425             
     426            oldLogDir.delete(); 
     427        } 
     428    } 
     429 
    401430    /* (non-Javadoc) 
    402431     * @see de.ugoe.cs.autoquest.htmlmonitor.HtmlMonitorComponent#stop() 
Note: See TracChangeset for help on using the changeset viewer.