r9593 - helma-ng/trunk/modules/helma
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090409080148.2DB733D0D6@mia> |
Author: hannes
Date: 2009-04-09 10:01:48 +0200 (Thu, 09 Apr 2009)
New Revision: 9593
Modified:
helma-ng/trunk/modules/helma/logging.js
Log:
Make helma.logging.setConfig() take a resource object as argument, and use the java.net.URL to configure log4j so it works with all kinds of repositories, not just FileRepositories.
Details at http://dev.helma.org/trac/helma/changeset/9593
Modified: helma-ng/trunk/modules/helma/logging.js
===================================================================
--- helma-ng/trunk/modules/helma/logging.js 2009-04-08 18:17:41 UTC (rev 9592)
+++ helma-ng/trunk/modules/helma/logging.js 2009-04-09 08:01:48 UTC (rev 9593)
@@ -13,12 +13,13 @@
* e.g. <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' reset="true">
*/
exports.setConfig = function(resource) {
- var configurator = resource.endsWith('.properties') || resource.endsWith('.props') ?
+ var {path, url} = resource;
+ var configurator = path.endsWith('.properties') || path.endsWith('.props') ?
org.apache.log4j.PropertyConfigurator :
org.apache.log4j.xml.DOMConfigurator;
- configurator.configure(resource);
+ configurator.configure(url);
try {
- configurator.configureAndWatch(resource, 2000);
+ configurator.configureAndWatch(path, 2000);
} catch (e) {
print("Error watching log configuration file:", e);
}
@@ -31,7 +32,7 @@
exports.getLogger = function(name) {
if (!configured) {
// getResource('foo').name gets us the absolute path to a local resource
- this.setConfig(getResource('config/log4j.properties').path);
+ this.setConfig(getResource('config/log4j.properties'));
}
return org.apache.log4j.Logger.getLogger(name);
}