mardi 18 avril 2017

How can i use log4php inside functions

What is the correct form to do use log4php inside a class with functions?

<?php
include_once 'log4php-2.3.0/src/main/php/Logger.php';

class template
{
  public static temp1;
  public static temp2;
  Logger::configure($path . '\commons\log4php-2.3.0\config.xml');
  $log = Logger::getLogger('myLogger');

  public static function example1()
  {

  }

  public static function example2()
  {

  }

}

How can I call $log->fatal($error); for example inside both functions? Should i redeclare the $log in each or how?






Comments
0 Comments

0 commentaires:

Enregistrer un commentaire