Table of Contents

Login/Logoff logging plugin

loglog plugin by Andreas Gohr
Logs all login and logout actions with time, IP and username

Last updated on 2008-06-11. Provides Action.
Compatible with DokuWiki 2008-05-05 and newer.

Tagged with authentication, logging, login, logout.

This Plugin will log all logins and logouts to data/cache/loglog.log.

Download

There is a darcs repository available at http://dev.splitbrain.org/darcs/dwplugins/loglog/.

Changes

Mod: Log to a wiki page

This small change:

The idea is just to create and modify a DokuWiki loglog.txt article in the wiki namespace (instead of writing it to the data/cache/loglog.log file). You get a list like:

If you want to remove old logging info, you can simply remove lines from this wiki:loglog.txt article manually.

Here is the alternative _log function (to be changed in the plugin's action.php):

 function _log($msg){
        global $conf;
 
        $t   = time();
        $log = "  * "."\t".strftime($conf['dformat'],$t)."\t".$_SERVER['REMOTE_ADDR']."\t\t**".$_SERVER['REMOTE_USER']."**:\t**".$msg."**  \n";
 
        /*io_saveFile($conf['cachedir'].'/loglog.log',"$log\n",true);*/
 
        $logFilename = $conf['datadir'].'/loglog.txt';        
 
        // read logfile
        $fc=file($logFilename);
 
        // Add the new log message to the logfile ...
        $f = fopen($logFilename, 'w') or die("can't open file");
        fwrite($f, $log);
        fclose($f);
 
        // ... and the lines that were already in the log file
        $f = fopen($logFilename, 'a') or die("can't open file");
        foreach($fc as $line)
        {
           fwrite($f, $line);
        }
        fclose($f);
 
    }

Juergen Mueller 2008-01-08 18:26