diff options
-rw-r--r-- | acf.conf | 4 | ||||
-rw-r--r-- | app/acf_www-controller.lua | 16 | ||||
-rw-r--r-- | www/cgi-bin/mvc.lua | 2 |
3 files changed, 17 insertions, 5 deletions
@@ -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 |