Logger class oLogger: Generate and process logs files in XML format

Recommend this page to a friend!
  Info   View files (7)   Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 744 All time: 4,445 This week: 794
Version License Categories
ologger 1.0Free for non-comm...XML, PHP 5, Logging
Description Author

This class can be used to generate and process log files stored in XML format.

The class can add new log entries defined by XML nodes using values defined in an array class variable.

The class can also parse a log file and display the log entries.

Picture of Johan Barbier
Name: Johan Barbier <contact>
Classes: 17 packages by
Country: France France
Age: 48
All time rank: 402 in France France
Week rank: 61 5 in France France
Innovation award
Innovation award
Nominee: 6x


Ceci est une classe de log.
La classe en elle-même se trouve dans le répertoire class/class.oLogger.php

Les 2 fichiers log.consult.php et log.detail.php sont là pour un exemple d'utilisation.
Je les ai extirpé de ma propre interface...donc c'est du bidouillage pour que ça tourne en local lol :-) A vous de bidouiller la css fournie.
Mais vous avez déjà une bonne base quand même, un bon exemple d'utilisation des logs créés.

Les logs sont déjà créés évidemment.

Pour créer les logs, personnellement, je les ai mis dans ma classe DB, dans la méthode effectuant une requête (oDB::query). Je ne logge pas les SELECT, mais ça, c'est un choix :-)
Donc, je lance mon log ainsi :

if (true === $log && substr (strtoupper (trim ($this->s_db_sql)), 0, 6) !== 'SELECT') {
	$ologger = new oLogger;
	$destId = (isset ($_SESSION['dest_id']))?$_SESSION['dest_id']:0;
	$ologger -> init ($this -> s_db_sql, $destId);

C'est tout! C'est ce petit bout de code qui a généré les quelques logs que je montre ici.


This is a log class.
The class in itself is in the folder 'class/class.oLogger.php'

The 2 files log.consult.php and log.detail.php are here to show an exemple of how to handle these logs.
I took them from my own UI, so...I just did what needed to be done for theml to work locally.
You can (and should) modify them for your use! 
But this is a good ground I think.

The logs are already created, of course...
But, to create them, here is what I did : 
I put this code in my database class oDB, in its query method (like mysql_query...).
I do not log the SELECT queries, but that's a choice. So, my code is juste this one :

if (true === $log && substr (strtoupper (trim ($this->s_db_sql)), 0, 6) !== 'SELECT') {
	$ologger = new oLogger;
	$destId = (isset ($_SESSION['dest_id']))?$_SESSION['dest_id']:0;
	$ologger -> init ($this -> s_db_sql, $destId);

Thaty's all! It's enough to create the needed logs through the whole application.
Oh : $_SESSION['dest_id'] contains the current user id. Just replace it by YOUR way to store your user's id.
File Role Description
class (1 file)
css (1 file)
logs (2 directories)
log.consult.php Example Exemple
log.detail.php Example Example
readme.txt Doc. documentation

  Files  /  class  
File Role Description
   class.oLogger.php Class Logger class

  Files  /  css  
File Role Description
   main.css Data css file

  Files  /  logs  
File Role Description
3026 (1 file)
6 (1 file)

  Files  /  logs  /  3026  
File Role Description
   20060420.xml Output log file

  Files  /  logs  /  6  
File Role Description
   20060420.xml Output log file

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:4,445
This week:794

For more information send a message to info at phpclasses dot org.