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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-15-2008, 11:29 PM
Junior Member
 
Join Date: Aug 2008
Posts: 28
Default zend_log not writing to file

Hi,
I am trying to do some logging with Zend_Log, but it's not working for me. Maybe someone could tell me where I have gone wrong. I have this in my bootstrap file:
PHP Code:
$writer = new Zend_Log_Writer_Stream(ROOT_DIR '/tmp/log.txt');
$logger = new Zend_Log($writer);
Zend_Registry::set('logger'$logger); 
I am trying to log when someone uses an action in one of my controllers, so in the controller file within the code for that action I have added:
PHP Code:
$msg 'we have success!';
        
$logger Zend_Registry::get('logger');
        
$logger->info($msg); 
I created my tmp folder with the log.txt file in the specified location, but nothing gets written to it. I checked the file permissions and they are rw for all. Am I missing something?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-20-2008, 03:51 AM
Junior Member
 
Join Date: Aug 2008
Posts: 28
Default

I've also discovered that when I change the path to where I want the write-to file to go I get an error that the path I chose 'cannot be opened with mode "a" ' What does this mean? Is it a clue?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-21-2008, 08:22 PM
Senior Member
 
Join Date: Jun 2008
Location: Florida
Posts: 108
Default

Does PHP have permissions to write to ROOT_DIR . '/tmp/log.txt'?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-21-2008, 11:41 PM
Junior Member
 
Join Date: Aug 2008
Posts: 28
Default

The file permissions on the server are set to rw-rw-rw.

I've decided that I'd rather save everything to a database anyway. So now I am wondering why I should even bother using Zend_log?

What I want to do is to have a "log" data table of who is moving inventory. In my Inventory controller I have a function called moveAction. I am thinking that I just need to add some lines of code inside that action that inserts the info. I want to record into my database. Wouldn't this be easier than using Zend_log?

PHP Code:
$log = new Log();
$row $log->createRow() ;
$row->user $user;
$row->date $date;
$row->item $item;
$row->save(); 
Am I missing something about the purpose of Zend_log or logging in general? I've seen some examples of setting up the column mapping, but I haven't found any examples of how the data actually gets written to the database (basically the replacement of what I have above.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-22-2008, 06:44 AM
Member
 
Join Date: Sep 2008
Location: Croatia
Posts: 57
Default

if your database gets unavailable (server down, unable to connect, etc..)how will you know? there will be no error logged...
thats why errors are logged in files (.bin most of time).
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 08:42 PM.