* Switch back to event log as default log for app-based logging.

This commit is contained in:
hns 2005-11-17 16:20:18 +00:00
parent 527a1bc846
commit b51be97d41
2 changed files with 26 additions and 19 deletions

View file

@ -1390,22 +1390,34 @@ public final class Application implements IPathElement, Runnable {
* Log a generic application event * Log a generic application event
*/ */
public void logEvent(String msg) { public void logEvent(String msg) {
if (eventLog == null) { getEventLog().info(msg);
eventLog = getLogger(eventLogName);
}
eventLog.info(msg);
} }
/** /**
* Log an application access * Log an application access
*/ */
public void logAccess(String msg) { 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) { if (accessLog == null) {
accessLog = getLogger(accessLogName); accessLog = getLogger(accessLogName);
} }
return accessLog;
accessLog.info(msg);
} }
/** /**

View file

@ -33,7 +33,6 @@ import org.apache.commons.logging.LogFactory;
*/ */
public class ApplicationBean implements Serializable { public class ApplicationBean implements Serializable {
Application app; Application app;
Log appLog;
WrappedMap properties = null; WrappedMap properties = null;
/** /**
@ -53,17 +52,13 @@ public class ApplicationBean implements Serializable {
} }
/** /**
* Get the app logger. This is a commons-logging Log with the * Get the app's event logger. This is a Log with the
* category helma.[appname].app. * category helma.[appname].event.
* *
* @return the app logger. * @return the app logger.
*/ */
public synchronized Log getLogger() { public Log getLogger() {
if (appLog == null) { return app.getEventLog();
appLog = app.getLogger(new StringBuffer("helma.")
.append(app.getName()).append(".app").toString());
}
return appLog;
} }
/** /**
@ -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 logname the name (category) of the log
* @param msg the log message * @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 * Log a DEBUG message to the log defined by logname
* app.properties. * if debug is set to true in app.properties.
* *
* @param logname the name (category) of the log * @param logname the name (category) of the log
* @param msg the log message * @param msg the log message