Answers.Body: <p>I can think of a way to do it the other way around, by defining your own civicrm logger and having it send to syslog. The problem is large stacktraces might get cut off and be formatted badly because of the way that works.</p>
  <p>To get php to send all its errors including 500-level errors to civi might not even be possible, because they happen before civi even gets to the point where it would be capable of writing a log. If civi can't even load because of error 500, it can't possibly write to its own log.</p>
  <p>Or if the error were to be in the CMS, then it might not be able to get to civi either.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-06T17:23:30.940Z
Answers.LastActivityDate: 2020-07-06T17:23:30.940Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>If you can't correlate the events in order, are you logging from different machines?</p>
  <p>Event correlation is a rabbit hole and there are a lot of great products (free and not free to do it) however, you should start by looking at your logging environment (which it sounds like you are).</p>
  <p>If you are using stock syslog, I recommend moving to syslog-ng. NG was designed to better acocmodate event correlation and is way better for diagnostics.</p>
  <p>Here is a link to an article on event correlation with NG but you should start by finding a good howto for installing NG on your distribution.</p>
  <p><a href="https://lwn.net/Articles/424459/" rel="nofollow noreferrer">https://lwn.net/Articles/424459/</a></p>
  <p>Good luck,</p>
  <p>Karl</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-07T01:30:05.437Z
Answers.LastActivityDate: 2020-07-07T01:30:05.437Z
Answers.UserDisplayName: Karl Tatgenhorst
Body: <p>I want to combine the output written to the civicrm log file and php_error.log.
  This is because I cannot alway conclude based on the time stamp what the order is of the messages in those files. Ideally, I would have them in a single file so that the 'whole story' is in one place.</p>
  <p>Is this possible? Ideally, I could catch the warnings that are sent to php_errorlog and write them  with the same routine as I use for writing to the logging.</p>
  
Tags: <civievent><debugging><logging>
Title: combining log and error output
ThreadText: # combining log and error output
  
  (Asked by: username_0 on 2020-07-06)
  
  I want to combine the output written to the civicrm log file and php\_error.log.
  This is because I cannot alway conclude based on the time stamp what the order is of the messages in those files. Ideally, I would have them in a single file so that the 'whole story' is in one place.
  
  Is this possible? Ideally, I could catch the warnings that are sent to php\_errorlog and write them with the same routine as I use for writing to the logging.
  
  **Tags:** civievent, debugging, logging
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-07-06. Score: 2 | Accepted answer
  
  I can think of a way to do it the other way around, by defining your own civicrm logger and having it send to syslog. The problem is large stacktraces might get cut off and be formatted badly because of the way that works.
  
  To get php to send all its errors including 500-level errors to civi might not even be possible, because they happen before civi even gets to the point where it would be capable of writing a log. If civi can't even load because of error 500, it can't possibly write to its own log.
  
  Or if the error were to be in the CMS, then it might not be able to get to civi either.
  
  
  ---
  
  ### Answer by username_2 on 2020-07-07. Score: 1
  
  If you can't correlate the events in order, are you logging from different machines?
  
  Event correlation is a rabbit hole and there are a lot of great products (free and not free to do it) however, you should start by looking at your logging environment (which it sounds like you are).
  
  If you are using stock syslog, I recommend moving to syslog-ng. NG was designed to better acocmodate event correlation and is way better for diagnostics.
  
  Here is a link to an article on event correlation with NG but you should start by finding a good howto for installing NG on your distribution.
  
  <https://lwn.net/Articles/424459/>
  
  Good luck,
  
  Karl
  
  
  ---
  
  