Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-30-2007, 05:44 AM
Junior Member
 
Join Date: May 2007
Posts: 9
Question Zend_Log_Writer_Db Problem - Customising table columns

Hello all,

I am trying to get Zend_Log_Writer_Db set up so that I can add some custom fields into my database for logging purposes.

I am trying to get the writer to be able to put a logged in user's username into a table field named "user" along with a timestamp, message, and priority.

The code I have currently is this:

// Set up the logging system and put it in the Zend Registry.
$user = array('USERNAME'); // It is an array because I found out that the Db writer wont accept strings...
Zend_Registry::set('user', $user);

$columnMapping = array('priority' => 'priority', 'message' => 'message', 'timestamp' => 'timestamp', 'user' => $user);
$writer = new Zend_Log_Writer_Db($DB, 'log', $columnMapping);

But this returns the error:

Warning: Illegal offset type in
/usr/local/apache2/Zend/library/Zend/Log/Writer/Db.php on line 103


Can anyone help me out here?

Kind regards,

Socceroos
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-27-2007, 03:08 PM
Junior Member
 
Join Date: Oct 2007
Posts: 4
Default same problem

did you solve it? I'm with the same problem, and also to find a way for Zend_Log run as it runs by default when I make it singleton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-10-2008, 04:46 AM
Junior Member
 
Join Date: May 2007
Posts: 9
Default

I did get it working. Here's the code I used:

Code:
  // Set up the logging system and put it in the Zend Registry.
  $columnMapping = array('priority' => 'priority', 'message' => 'message',
                         'timestamp' => 'timestamp', 'username' => 'user',
                         'address' => 'address');
  $writer = new Zend_Log_Writer_Db($DB, 'log', $columnMapping);
HTH,

Socceroos
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:59 PM.