Hi all,

I am fairly new to PHP (my experience is mostly in Java) and I have inherited a project that was initially implemented in PHP4. I am updating it to use PHP5 and at the same time I am trying to add Logging to the project. I am using the Pear Log package for this purpose, but I am having a bit of trouble getting it going. I am attempting to use a File Handler and my setup code looks like this:

class Booking
  private $log;
  public function Booking()
    $this->log = &Log::singleton('file', 'log.txt', 'Booking');

Then when I try to log something I write

public function getBookingTime()
  $this->log->debug("getBookingTime() entered.");
  return $this->bookingTime;

After I run my code I can't find a log.txt file anywhere. I also tried using a console handler to see if I could get the log output to console, but this also failed. Am I missing something here?

Thanks in advance for any advice,

Recommended Answers

Do you have permissions to write/modify a file ?

Jump to Post

All 2 Replies

The problem was that I had permission for writing a file, but the g and o permissions did not. Changing their settings worked. Thanks pritaeas! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.