IDEMPIERE-2951 Delete all Trace Logs from Monitor should not delete AuthFailure.log

This commit is contained in:
Nicolas Micoud 2016-08-08 18:29:20 +02:00
parent a8536f15af
commit 34926b0409
2 changed files with 5 additions and 1 deletions

View File

@ -35,13 +35,14 @@ public class LogAuthFailure {
private static FileOutputStream file = null;
private static Writer writer;
public static String authFailureFilename = "AuthFailure.log";
/** Logger */
private static CLogger log = CLogger.getCLogger(LogAuthFailure.class);
public LogAuthFailure() {
String path = Ini.getAdempiereHome() + File.separator + "log";
String name = path + File.separator + "AuthFailure.log";
String name = path + File.separator + authFailureFilename;
File fileName;
try {
fileName = new File(name);

View File

@ -39,6 +39,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.adempiere.util.LogAuthFailure;
import org.apache.ecs.HtmlColor;
import org.apache.ecs.xhtml.a;
import org.apache.ecs.xhtml.b;
@ -382,6 +383,8 @@ public class AdempiereMonitor extends HttpServlet
String fileName = logs[i].getAbsolutePath();
if (fileName.equals(fileHandler.getFileName()))
continue;
if (fileName.endsWith(LogAuthFailure.authFailureFilename)) // Do not delete login failure
continue;
if (logs[i].delete())
log.warning("Deleted: " + fileName);
else