changeset 1599:f2a663a4ba9e

web logging
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 05 Apr 2021 00:13:05 -0600
parents c78d6a4e2d9a
children 8a717f0b7f45
files src/luan/host/WebHandler.java src/luan/modules/ThreadLuan.java
diffstat 2 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/host/WebHandler.java	Sun Apr 04 15:09:51 2021 -0600
+++ b/src/luan/host/WebHandler.java	Mon Apr 05 00:13:05 2021 -0600
@@ -65,15 +65,13 @@
 			handler = new ListHandler( handler, notFoundHander );
 			handler = new ContentTypeHandler(handler);
 			handler = new SafeHandler(handler);
-			if( luanLogging )
-				handler = new LogHandler(handler,LogHandler.dirLogger(new File(logDir+"2")));
+			handler = new LogHandler(handler,LogHandler.dirLogger(new File(logDir)));
 
 			return new MyHandler(handler,luanHandler);
 		}
 	};
 
 	public static String securityPassword = "password";  // change for security
-	public static boolean luanLogging = false;
 	private static final DomainHandler domainHandler = new DomainHandler(factory);
 	private static String sitesDir = null;
 
--- a/src/luan/modules/ThreadLuan.java	Sun Apr 04 15:09:51 2021 -0600
+++ b/src/luan/modules/ThreadLuan.java	Mon Apr 05 00:13:05 2021 -0600
@@ -82,6 +82,7 @@
 		Number delay = Utils.removeNumber(options,"delay");
 		Number repeatingDelay = Utils.removeNumber(options,"repeating_delay");
 		Number repeatingRate = Utils.removeNumber(options,"repeating_rate");
+		Boolean dontGc = Utils.removeBoolean(options,"dont_gc");
 		String id = Utils.removeString(options,"id");
 		if( repeatingDelay!=null && repeatingRate!=null )
 			throw new LuanException("can't define both repeating_delay and repeating_rate");
@@ -108,12 +109,14 @@
 			scheduler.schedule(r,0L,TimeUnit.MILLISECONDS);
 			return;
 		}
-		Object c = new Object() {
-			protected void finalize() throws Throwable {
-				cancel(sf,"gc");
-			}
-		};
-		luan.registry().put(c,c);  // cancel on gc
+		if( !Boolean.TRUE.equals(dontGc) ) {
+			Object c = new Object() {
+				protected void finalize() throws Throwable {
+					cancel(sf,"gc");
+				}
+			};
+			luan.registry().put(c,c);  // cancel on gc
+		}
 		if( id != null )
 			scheduleds.put(id,sf);
 	}