Advertisement
Guest User

Error Logger

a guest
Sep 6th, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2. $text = $_GET['errorLog'];
  3. $pattern = '/Exception in thread "[a-zA-Z]+" java\.([a-z]*)(.*?)([A-Za-z]+):[\n\s\w]+at ([\w_.]*?).([\w]+)\(([\w\.]+.java:)([\d]+)\)/';
  4.  
  5. preg_match_all($pattern, $text, $matches);
  6.  
  7. /*var_dump($matches);*/
  8. echo "<ul>";
  9. for ($i = 0; $i < count($matches[2]); $i++) {
  10.     echo "<li>line <strong>".htmlspecialchars($matches[7][$i])."</strong> - <strong>".htmlspecialchars($matches[3][$i])."</strong> in <em>".htmlspecialchars($matches[6][$i]).htmlspecialchars($matches[5][$i])."</em></li>";
  11. }
  12. echo "</ul>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement