Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $errorLog = $_GET['errorLog'];
- preg_match_all('/Exception in thread \"[A-Za-z_.]+\"\s*java\.(.)+[A-Za-z]+\: [0-9]+\s*at [A-Za-z_.]+\.[A-Za-z]+\([A-Za-z_]+\.[A-Za-z]+\:[0-9]+\)/', $errorLog, $lines);
- $lineNumberArr = [];
- $methodArr = [];
- $fileNameArr = [];
- $exceptionsArr = [];
- foreach ($lines[0] as $line) {
- preg_match('/[0-9]+\)/', $line, $lineNumberArr[]);
- preg_match('/[A-Za-z_]+\(/', $line, $methodArr[]);
- preg_match('/\([A-Za-z_]+\.[A-Za-z]+/', $line, $fileNameArr[]);
- preg_match('/\.[A-Za-z]+\:/', $line, $exceptionsArr[]);
- }
- // clear all the brackets from the entries
- $fileNames = [];
- foreach ($fileNameArr as $entry) {
- foreach ($entry as $name) {
- $fileNames[] = substr($name, 1, strlen($name));
- }
- }
- // clear all the brackets from the entries
- $exceptions = [];
- foreach ($exceptionsArr as $line) {
- foreach ($line as $str) {
- $exceptions[] = substr($str, 1, strlen($str) - 2);
- }
- }
- // clear all the brackets from the entries
- $lineNum = [];
- foreach ($lineNumberArr as $entry) {
- foreach ($entry as $number) {
- $lineNum[] = substr($number, 0, strlen($number) - 1);
- }
- }
- // clear all the brackets from the entries
- $method= [];
- foreach ($methodArr as $entry) {
- foreach ($entry as $name) {
- $method[] = substr($name, 0, strlen($name) - 1);
- }
- }
- $output = "<ul>";
- for ($i = 0; $i <count($lines[0]); $i++) {
- $output .= "<li>line ";
- $output .= "<strong>" . htmlspecialchars($lineNum[$i]) . "</strong> - ";
- $output .= "<strong>" . htmlspecialchars($exceptions[$i]) . "</strong> in ";
- $output .= "<em>" . htmlspecialchars($fileNames[$i]) . ":" . htmlspecialchars($method[$i]) . "</em></li>";
- }
- $output .= "</ul>";
- echo $output;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement