summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-12-30 15:06:08 +0000
committerTed Trask <ttrask01@yahoo.com>2009-12-30 15:06:08 +0000
commit574e7b03768daa9f1c038f4e6742937f385282ef (patch)
tree0d023e8c1fb91517ec3d1f639e753bd548b1ab8c
parent6c9f16f82e911e1b2c05918f9b8ce0d78fb3aa55 (diff)
downloadacf-core-574e7b03768daa9f1c038f4e6742937f385282ef.tar.bz2
acf-core-574e7b03768daa9f1c038f4e6742937f385282ef.tar.xz
Added logfile config setting to acf.conf
-rw-r--r--acf.conf4
-rw-r--r--app/acf_www-controller.lua16
-rw-r--r--www/cgi-bin/mvc.lua2
3 files changed, 17 insertions, 5 deletions
diff --git a/acf.conf b/acf.conf
index be952b7..64c8e40 100644
--- a/acf.conf
+++ b/acf.conf
@@ -8,6 +8,10 @@ wwwdir=/usr/share/acf/www/
# sessiondir is where the session state files are stored
sessiondir=/tmp/
+# logfile - if undefined will log with system logger
+# only applies to web access, client access will always use system logger
+logfile = /var/log/acf.log
+
# ACF is skinnable - these specifiy the active skin
skindir=/skins/
skin=alps
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua
index 9c63d74..1977491 100644
--- a/app/acf_www-controller.lua
+++ b/app/acf_www-controller.lua
@@ -219,7 +219,9 @@ end
mvc = {}
mvc.on_load = function (self, parent)
-- open the log file
- self.conf.logfile = io.open ("/var/log/acf.log", "a+")
+ if self.conf.logfile then
+ self.conf.loghandle = io.open (self.conf.logfile, "a+")
+ end
--logevent("acf_www-controller mvc.on_load")
@@ -289,7 +291,9 @@ mvc.on_unload = function (self)
end
-- Close the logfile
--logevent("acf_www-controller mvc.on_unload")
- self.conf.logfile:close()
+ if self.conf.loghandle then
+ self.conf.loghandle:close()
+ end
end
-- Overload the MVC's exception handler with our own to handle redirection
@@ -542,7 +546,11 @@ parse_redir_string = function( str )
return prefix, controller, action
end
--- FIXME - need to think more about this..
logevent = function ( message )
- conf.logfile:write (string.format("%s: %s\n", os.date(), message or ""))
+ if conf.loghandle then
+ conf.loghandle:write (string.format("%s: %s\n", os.date(), message or ""))
+ else
+ -- call to parent's handler
+ __index.logevent(message)
+ end
end
diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua
index db29bda..efaca5f 100644
--- a/www/cgi-bin/mvc.lua
+++ b/www/cgi-bin/mvc.lua
@@ -342,5 +342,5 @@ end
_G.cfe = cfe
logevent = function ( ... )
- os.execute ( "logger \"" .. (... or "") .. "\"" )
+ os.execute ( "logger \"ACF: " .. (... or "") .. "\"" )
end