Removed fancy debug logging from web server to prevent logging causing logging due to logging Monitor lock/unlock calls. Need to replace this logging code with a non-framework queue to allow remote management of the web server and log transfer.
This commit is contained in:
@@ -16,6 +16,7 @@ import java.util.zip.ZipEntry;
|
|||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import com.common.comparison.Comparator;
|
import com.common.comparison.Comparator;
|
||||||
|
import com.common.debug.ConsoleLog;
|
||||||
import com.common.debug.Debug;
|
import com.common.debug.Debug;
|
||||||
import com.common.debug.DefaultLog;
|
import com.common.debug.DefaultLog;
|
||||||
import com.common.debug.ILog;
|
import com.common.debug.ILog;
|
||||||
@@ -99,6 +100,54 @@ public class WebServerApplication extends Application implements IWebServer {
|
|||||||
/** The server application's metadata. Used currently to house the logging. */
|
/** The server application's metadata. Used currently to house the logging. */
|
||||||
private ServerApp serverApp = null;
|
private ServerApp serverApp = null;
|
||||||
|
|
||||||
|
private static class AppLog extends ConsoleLog implements IAppLog {
|
||||||
|
public void log(int type, String note, Throwable exception) {
|
||||||
|
log(note, exception, type, true);
|
||||||
|
}//log()//
|
||||||
|
/*
|
||||||
|
private boolean suspend = false;
|
||||||
|
|
||||||
|
public void log(int type, String note, Throwable exception) {
|
||||||
|
//Prevent the act of logging from generating logs since it would create an infinate loop.//
|
||||||
|
if(!suspend) {
|
||||||
|
suspend = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
IWebappLog log = metadata.getLog();
|
||||||
|
|
||||||
|
if(log != null) {
|
||||||
|
switch(type) {
|
||||||
|
case WebappLogEntry.TYPE_ERROR: {
|
||||||
|
metadata.setErrorCount(new Integer(metadata.getErrorCount().intValue() + 1));
|
||||||
|
break;
|
||||||
|
}//case//
|
||||||
|
case WebappLogEntry.TYPE_WARNING: {
|
||||||
|
metadata.setWarningCount(new Integer(metadata.getWarningCount().intValue() + 1));
|
||||||
|
break;
|
||||||
|
}//case//
|
||||||
|
case WebappLogEntry.TYPE_INFORMATION: {
|
||||||
|
metadata.setInfoCount(new Integer(metadata.getInfoCount().intValue() + 1));
|
||||||
|
break;
|
||||||
|
}//case//
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}//case//
|
||||||
|
}//switch//
|
||||||
|
|
||||||
|
((WebappLog) Orb.getLocal(log)).addEntry(new WebappLogEntry(type, note, exception));
|
||||||
|
}//if//
|
||||||
|
else {
|
||||||
|
new RuntimeException("ERROR: Failed to log for a web application due to a missing webapp log object.").printStackTrace();
|
||||||
|
}//else//
|
||||||
|
}//try//
|
||||||
|
finally {
|
||||||
|
suspend = false;
|
||||||
|
}//finally//
|
||||||
|
}//if//
|
||||||
|
}//log()//
|
||||||
|
*/
|
||||||
|
}//AppLog//
|
||||||
|
|
||||||
private static class AppMetadata {
|
private static class AppMetadata {
|
||||||
public String className = null;
|
public String className = null;
|
||||||
}//AppMetadata//
|
}//AppMetadata//
|
||||||
@@ -362,40 +411,7 @@ protected void startApplication(File serverXmlPath) {
|
|||||||
try {
|
try {
|
||||||
setServerApp(new ServerApp(serverXmlPath.getParentFile()));
|
setServerApp(new ServerApp(serverXmlPath.getParentFile()));
|
||||||
getServerApp().getInfoChangeFlag();
|
getServerApp().getInfoChangeFlag();
|
||||||
Debug.setLog(new DefaultLog() {
|
Debug.setLog(new AppLog());
|
||||||
private boolean suspend = false;
|
|
||||||
public void log(String note, Throwable exception, int type, boolean forceDisplay) {
|
|
||||||
//Prevent the act of logging from generating logs since it would create an infinate loop.//
|
|
||||||
if(!suspend) {
|
|
||||||
suspend = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
switch(type) {
|
|
||||||
case WebappLogEntry.TYPE_ERROR: {
|
|
||||||
getServerApp().setErrorCount(new Integer(getServerApp().getErrorCount().intValue() + 1));
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
case WebappLogEntry.TYPE_WARNING: {
|
|
||||||
getServerApp().setWarningCount(new Integer(getServerApp().getWarningCount().intValue() + 1));
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
case WebappLogEntry.TYPE_INFORMATION: {
|
|
||||||
getServerApp().setInfoCount(new Integer(getServerApp().getInfoCount().intValue() + 1));
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
}//switch//
|
|
||||||
|
|
||||||
((WebappLog) Orb.getLocal(getServerApp().getLog())).addEntry(new WebappLogEntry(type, note, exception));
|
|
||||||
}//try//
|
|
||||||
finally {
|
|
||||||
suspend = false;
|
|
||||||
}//finally//
|
|
||||||
}//if//
|
|
||||||
}//log()//
|
|
||||||
});
|
|
||||||
}//try//
|
}//try//
|
||||||
catch(Throwable e) {
|
catch(Throwable e) {
|
||||||
Debug.log(e);
|
Debug.log(e);
|
||||||
@@ -1111,47 +1127,7 @@ protected void loadWebApplications(final WebappBundle metadata) throws IOExcepti
|
|||||||
try {
|
try {
|
||||||
Class cls = classLoader.findClass(app.className);
|
Class cls = classLoader.findClass(app.className);
|
||||||
IWebApplicationFactory webApplicationFactory = (IWebApplicationFactory) cls.newInstance();
|
IWebApplicationFactory webApplicationFactory = (IWebApplicationFactory) cls.newInstance();
|
||||||
IAppLog appLog = new IAppLog() {
|
IAppLog appLog = new AppLog();
|
||||||
private boolean suspend = false;
|
|
||||||
public void log(int type, String note, Throwable exception) {
|
|
||||||
//Prevent the act of logging from generating logs since it would create an infinate loop.//
|
|
||||||
if(!suspend) {
|
|
||||||
suspend = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
IWebappLog log = metadata.getLog();
|
|
||||||
|
|
||||||
if(log != null) {
|
|
||||||
switch(type) {
|
|
||||||
case WebappLogEntry.TYPE_ERROR: {
|
|
||||||
metadata.setErrorCount(new Integer(metadata.getErrorCount().intValue() + 1));
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
case WebappLogEntry.TYPE_WARNING: {
|
|
||||||
metadata.setWarningCount(new Integer(metadata.getWarningCount().intValue() + 1));
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
case WebappLogEntry.TYPE_INFORMATION: {
|
|
||||||
metadata.setInfoCount(new Integer(metadata.getInfoCount().intValue() + 1));
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}//case//
|
|
||||||
}//switch//
|
|
||||||
|
|
||||||
((WebappLog) Orb.getLocal(log)).addEntry(new WebappLogEntry(type, note, exception));
|
|
||||||
}//if//
|
|
||||||
else {
|
|
||||||
new RuntimeException("ERROR: Failed to log for a web application due to a missing webapp log object.").printStackTrace();
|
|
||||||
}//else//
|
|
||||||
}//try//
|
|
||||||
finally {
|
|
||||||
suspend = false;
|
|
||||||
}//finally//
|
|
||||||
}//if//
|
|
||||||
}//log()//
|
|
||||||
};
|
|
||||||
|
|
||||||
metadata.setWebApplications(webApplicationFactory.createWebApplications(metadata.getBaseDirectory(), externalApp == null || externalApp.externalBaseDirectory == null ? null : new File(externalApp.externalBaseDirectory), externalApp == null || externalApp.cacheBaseDirectory == null ? null : new File(externalApp.cacheBaseDirectory), appLog, externalApp == null ? new Properties(System.getProperties()) : externalApp.properties));
|
metadata.setWebApplications(webApplicationFactory.createWebApplications(metadata.getBaseDirectory(), externalApp == null || externalApp.externalBaseDirectory == null ? null : new File(externalApp.externalBaseDirectory), externalApp == null || externalApp.cacheBaseDirectory == null ? null : new File(externalApp.cacheBaseDirectory), appLog, externalApp == null ? new Properties(System.getProperties()) : externalApp.properties));
|
||||||
metadata.setWebApplicationFactory(webApplicationFactory);
|
metadata.setWebApplicationFactory(webApplicationFactory);
|
||||||
|
|||||||
Reference in New Issue
Block a user