Login   Register  
PHP Classes
elePHPant
Icontem

XML log file

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Extended MySQLi  >  All threads  >  XML log file  >  (Un) Subscribe thread alerts  
Subject:XML log file
Summary:XML log file
Messages:3
Author:Valentino Lauciani
Date:2010-06-10 09:23:13
Update:2010-06-10 16:07:17
 

  1. XML log file   Reply   Report abuse  
Picture of Valentino Lauciani
Valentino Lauciani
2010-06-10 09:23:14
Hello again ;-)

About the file "db-log.xml" I have to create It or it is created automatically (apache has the permission to create it...)?

To do a test, I've set:
define('DB_LOG_XML',TRUE);
define('DB_URL_XML','/home/valentino/db-log.xml');

But executing only the FIRST EXAMPLE query (copied from index.php file, and changed with my parameters) I can see the array with the results, but I receive this message at the end of the page:

Notice: Undefined variable: xml in /home/ads/public_html/mysql/mysql.class.php on line 387

Fatal error: Call to a member function addChild() on a non-object in /home/ads/public_html/mysql/mysql.class.php on line 387


What does It mean?

Thank you.

  2. Re: XML log file   Reply   Report abuse  
Picture of Valentino Lauciani
Valentino Lauciani
2010-06-10 11:45:51 - In reply to message 1 from Valentino Lauciani
Hi

I think I've found the problem:

The lines 383 and 384 are:
if (file_exists(DB_URL_XML)) if (!$xml = @simplexml_load_file(DB_URL_XML)) $this->logError('[all]',0,'fatal','Log file exists, but I couldn\'t read it! Please check file permissions or disk array!');
else $xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?><db_log></db_log>');

Adding compound brackets, It is:
if (file_exists($this->db_url_xml)) {
if (!$xml = @simplexml_load_file($this->db_url_xml)) {
$this->logError('[all]',0,'fatal','Log file exists, but I couldn\'t read it! Please check file permissions or disk array!');
} else {
$xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?><db_log></db_log>');
}
}

that could be (i think) wrong.

I've changed that lines with:
if (file_exists($this->db_url_xml)) {
if (!$xml = @simplexml_load_file($this->db_url_xml)) {
$this->logError('[all]',0,'fatal','Log file exists, but I couldn\'t read it! Please check file permissions or disk array!');
}
} else {
$xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?><db_log></db_log>');
}

And now It works; creating the log file (If not exists) and writing the XML inside.

Let me know If I've wrong.
Thank you.
But I think

  3. Re: XML log file   Reply   Report abuse  
Picture of Camilo Sperberg
Camilo Sperberg
2010-06-10 16:07:17 - In reply to message 2 from Valentino Lauciani
some time ago i've had some problems also with this function, bit I never looked further into it.
I guess I'll include your changes into the next version (Obviously with the credits :) )

Greetings and thanks !