Changeset 1227 for trunk/autoquest-htmlmonitor/src/main/java/de/ugoe
- Timestamp:
- 06/26/13 15:30:58 (11 years ago)
- Location:
- trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlClientInfos.java
r1019 r1227 92 92 } 93 93 94 /** 95 * @return the id of the monitored web application which is the host and port 96 */ 97 String getWebAppId() { 98 String id = url.getHost(); 99 if ("".equals(id)) { 100 id = "unknown"; 101 } 102 103 if (url.getPort() > 0) { 104 id += "_" + url.getPort(); 105 } 106 107 return id; 108 } 109 94 110 } -
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorLogManager.java
r1069 r1227 41 41 * the timeout after which a writer of an inactive client is closed 42 42 */ 43 private static final int SESSION_TIMEOUT = 10 0000;43 private static final int SESSION_TIMEOUT = 10 * 60 * 1000; 44 44 45 45 /** … … 126 126 writer = writers.get(clientInfos.getClientId()); 127 127 if (writer == null) { 128 writer = 129 new HtmlMonitorOutputWriter(logFileBaseDir, clientInfos.getClientId()); 128 writer = new HtmlMonitorOutputWriter 129 (logFileBaseDir, clientInfos.getWebAppId(), clientInfos.getClientId()); 130 130 131 writer.init(); 131 132 writer.start(); -
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorOutputWriter.java
r1089 r1227 51 51 * the maximum size of an individual log file 52 52 */ 53 private static final int MAXIMUM_LOG_FILE_SIZE = 10000000;53 private static final int MAXIMUM_LOG_FILE_SIZE = 50000000; 54 54 55 55 /** … … 62 62 */ 63 63 private File logFileBaseDir; 64 65 /** 66 * the id of the web application used by the client 67 */ 68 private String webAppId; 64 69 65 70 /** … … 97 102 * @param logFileBaseDir the log file base directory, or null if the default directory shall 98 103 * be taken 104 * @param webAppId the ID of the web application used by the client 99 105 * @param clientId the ID of the client, for which this writer logs 100 106 */ 101 public HtmlMonitorOutputWriter(String logFileBaseDir, String clientId) {107 public HtmlMonitorOutputWriter(String logFileBaseDir, String webAppId, String clientId) { 102 108 if (logFileBaseDir == null) { 103 109 this.logFileBaseDir = new File(DEFAULT_LOG_FILE_BASE_DIR); … … 107 113 } 108 114 115 this.webAppId = webAppId; 109 116 this.clientId = clientId; 110 117 … … 123 130 synchronized (HtmlMonitorOutputWriter.class) { 124 131 try { 125 File clientLogDir = new File(logFileBaseDir, clientId); 126 132 File clientLogDir = new File(logFileBaseDir, webAppId); 133 clientLogDir = new File(clientLogDir, clientId); 134 127 135 if (!clientLogDir.exists()) { 128 136 if (!clientLogDir.mkdirs()) { … … 136 144 } 137 145 146 handleOldLogFiles(new File(logFileBaseDir, clientId), clientLogDir); 147 138 148 logFile = new File(clientLogDir, getLogFileName(-1)); 139 149 … … 318 328 } 319 329 else { 320 val = value.toString();330 val = String.valueOf(value); 321 331 } 322 332 … … 399 409 } 400 410 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 401 430 /* (non-Javadoc) 402 431 * @see de.ugoe.cs.autoquest.htmlmonitor.HtmlMonitorComponent#stop()
Note: See TracChangeset
for help on using the changeset viewer.