Scalr::logException PHP Method

logException() public static method

Adds catchable exception to standart PHP error log
public static logException ( Exception $e )
$e Exception The exception to log
    public static function logException($e)
    {
        @error_log("PHP Fatal error: Uncaught exception '" . get_class($e) . "' " . "with message '" . $e->getMessage() . "' " . "in " . $e->getFile() . ":" . $e->getLine() . "\n" . "Stack trace:\n " . str_replace("\n#", "\n  #", $e->getTraceAsString()));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  * @see Scalr\Tests\TestCase::tearDownAfterClass()
  */
 public static function tearDownAfterClass()
 {
     foreach (static::$testData as $rec) {
         if ($rec['class'] === Farm::class) {
             $entry = $rec['pk'];
             $farm = Farm::findPk(...$entry);
             /* @var $farm Farm */
             if (!empty($farm)) {
                 try {
                     \Scalr::FireEvent($farm->id, new FarmTerminatedEvent(false, false, false, false, true, static::$user->id));
                     foreach ($farm->servers as $server) {
                         try {
                             $dbServer = Server::findPk($server->serverId);
                             /* @var $dbServer Server */
                             $dbServer->terminate(Server::TERMINATE_REASON_FARM_TERMINATED, true, static::$user);
                         } catch (Exception $e) {
                             \Scalr::logException($e);
                         }
                         $server->delete();
                     }
                 } catch (Exception $e) {
                     \Scalr::logException($e);
                 }
             }
         }
     }
     parent::tearDownAfterClass();
 }
All Usage Examples Of Scalr::logException