Advertisement
dimipan80

Error Logger

May 1st, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php
  2. $errorLog = $_GET['errorLog'];
  3. $pattern = "/Exception in thread \".*\" java.*\.\s*(.+?)\s*:.*\n.*?\.\s*(.+?)\s*\(\s*(.+?)\s*:\s*(\d+?)\s*\)/";
  4.  
  5. preg_match_all($pattern, $errorLog, $matches, PREG_SET_ORDER);
  6. echo '<ul>';
  7. foreach ($matches as $match) {
  8.     $line = htmlspecialchars($match[4]);
  9.     $exception = htmlspecialchars($match[1]);
  10.     $filename = htmlspecialchars($match[3]);
  11.     $method = htmlspecialchars($match[2]);
  12.     echo "<li>line <strong>{$line}</strong> - <strong>{$exception}</strong> in <em>{$filename}:{$method}</em></li>";
  13. }
  14.  
  15. echo '</ul>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement