From b51be97d410d9824b676184e33514a11e9630290 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 17 Nov 2005 16:20:18 +0000 Subject: [PATCH] * Switch back to event log as default log for app-based logging. --- src/helma/framework/core/Application.java | 26 ++++++++++++++----- src/helma/framework/core/ApplicationBean.java | 19 +++++--------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index 94db7327..9551483b 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -1390,22 +1390,34 @@ public final class Application implements IPathElement, Runnable { * Log a generic application event */ public void logEvent(String msg) { - if (eventLog == null) { - eventLog = getLogger(eventLogName); - } - - eventLog.info(msg); + getEventLog().info(msg); } /** * Log an application access */ public void logAccess(String msg) { + getAccessLog().info(msg); + } + + /** + * get the app's event log. + */ + Log getEventLog() { + if (eventLog == null) { + eventLog = getLogger(eventLogName); + } + return eventLog; + } + + /** + * get the app's access log. + */ + Log getAccessLog() { if (accessLog == null) { accessLog = getLogger(accessLogName); } - - accessLog.info(msg); + return accessLog; } /** diff --git a/src/helma/framework/core/ApplicationBean.java b/src/helma/framework/core/ApplicationBean.java index fb962439..ef7ddc62 100644 --- a/src/helma/framework/core/ApplicationBean.java +++ b/src/helma/framework/core/ApplicationBean.java @@ -33,7 +33,6 @@ import org.apache.commons.logging.LogFactory; */ public class ApplicationBean implements Serializable { Application app; - Log appLog; WrappedMap properties = null; /** @@ -53,17 +52,13 @@ public class ApplicationBean implements Serializable { } /** - * Get the app logger. This is a commons-logging Log with the - * category helma.[appname].app. + * Get the app's event logger. This is a Log with the + * category helma.[appname].event. * * @return the app logger. */ - public synchronized Log getLogger() { - if (appLog == null) { - appLog = app.getLogger(new StringBuffer("helma.") - .append(app.getName()).append(".app").toString()); - } - return appLog; + public Log getLogger() { + return app.getEventLog(); } /** @@ -86,7 +81,7 @@ public class ApplicationBean implements Serializable { } /** - * Log a INFO message to the app log. + * Log a INFO message to the log defined by logname. * * @param logname the name (category) of the log * @param msg the log message @@ -108,8 +103,8 @@ public class ApplicationBean implements Serializable { } /** - * Log a DEBUG message to the app log if debug is set to true in - * app.properties. + * Log a DEBUG message to the log defined by logname + * if debug is set to true in app.properties. * * @param logname the name (category) of the log * @param msg the log message