Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] error_log - plik loga niedostępny
bulimaxiu
post
Post #1





Grupa: Zarejestrowani
Postów: 83
Pomógł: 0
Dołączył: 18.06.2008
Skąd: Reda

Ostrzeżenie: (0%)
-----


Witam.

Mam klasę typu errorhandler. error_log zapisuje błędy do pliku
  1. error_log ($err, 3, $this->log_filename);
W __destruct jest funkcja w której sprawdzam
  1. is_file($this->log_filename)
która zwraca FALSE. Gdy w tym samym skrypcie zapytam o historyczny log to zwraca TRUE i jest OK. file_exists - podobnie.

Czy ten error_log buforuje log i po zakończeniu skryptu dopiero go zapisuje?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
bulimaxiu
post
Post #2





Grupa: Zarejestrowani
Postów: 83
Pomógł: 0
Dołączył: 18.06.2008
Skąd: Reda

Ostrzeżenie: (0%)
-----


  1. function __destruct () {
  2. if (is_file($this->log_filename)) { // return false
  3. // Packing log file into ZIP package
  4. require_once ('zip.class.php');
  5. $zipfile = new zipfile;
  6. $zipfile->create_file(file_get_contents ($this->log_filename), basename($this->log_filename));
  7. file_put_contents ([b]$this->log_filename_zip[/b], $zipfile->zipped_file());
  8. unSet ($zipfile);
  9. unlink ($this->log_filename); // Comment this line if You don't want delete original html file.
  10. }
  11.  
  12. // Sending e-mail
  13. if ($this->send_mail == true AND (empty($this->send_deadline) OR (strtotime($this->send_deadline) > strtotime($this->date)))) {
  14. // ........
  15. $this->SendMail(); // return error with $this->log_filename_zip
  16. }
  17. }
  1. public function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars='') {
  2. $err = file_get_contents ($this->ROOT . 'errorhandler_log.tpl');
  3. $search = Array ('$errno$', '$errmsg$', '$filename$', '$linenum$', '$vars$', '$id$');
  4. $replace = Array ($errno, $errmsg, $filename, $linenum, print_r($vars, 1), $id);
  5. $err = str_replace ($search, $replace, $err);
  6.  
  7. error_log ($err, 3, $this->log_filename);
  8. }
  9. }


Ten post edytował bulimaxiu 28.09.2011, 14:01:03
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 27.12.2025 - 19:56