Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser Edge Case #8

Open
ps opened this issue Jun 6, 2017 · 1 comment
Open

Parser Edge Case #8

ps opened this issue Jun 6, 2017 · 1 comment

Comments

@ps
Copy link

ps commented Jun 6, 2017

The following line is not parsed properly:

[2017-05-31 14:16:19] testing.WARNING: DB - Query to get user_id for inactive login; logging only username in the table  [] {"file":"/home/pawel/project/app/Http/Controllers/Auth/LoginController.php","line":108,"class":"App\\Http\\Controllers\\Auth\\LoginController","function":"check"}

The following code was used to test:

// where 'sample_log.log' contains the log statement above'
$reader = new LogReader('sample_log.log');
foreach ($reader as $logLine) {
    var_dump($logLine);
}

Resulting parsing:

array(6) {
  'date' =>
  class DateTime#54 (3) {
    public $date =>
    string(26) "2017-05-31 14:16:19.000000"
    public $timezone_type =>
    int(3)
    public $timezone =>
    string(16) "America/New_York"
  }
  'logger' =>
  string(7) "testing"
  'level' =>
  string(7) "WARNING"
  'message' =>
  string(70) "DB - Query to get user_id for inactive login; logging only username in"
  'context' =>
  NULL
  'extra' =>
  NULL
}

By inspecting the log statement above manually it is obvious that the 'message' was cut off and there does exist an 'extra' array with attributes but was not parsed either.

@ps
Copy link
Author

ps commented Jun 6, 2017

FYI ddtraceweb's monolog-parser package handles this edge case without an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant