Answers.Body: <p>Re "where can I view the results" - if you want to view the log via the GUI try <a href="https://civicrm.org/extensions/civicrm-log-viewer" rel="nofollow noreferrer">the log viewer extension</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-12T19:35:22.947Z
Answers.Text: cool. Thank you!
Answers.UserDisplayName: safron
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T18:47:20.643Z
Answers.LastActivityDate: 2020-06-11T18:47:20.643Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>At the link you referenced it says you can use <code>Civi::log()-&gt;debug();</code> <a href="https://docs.civicrm.org/dev/en/latest/tools/debugging/#viewing-log-files" rel="nofollow noreferrer">this section</a>, so for example <code>Civi::log()-&gt;debug(var_export($my_variable, true));</code></p>
  
  <p>I'm not sure what you mean by the directory isn't available? This article says how to find it: <a href="https://civicrm.stackexchange.com/questions/15931/where-are-the-configandlog-and-templates-c-directories">Where are the &quot;ConfigAndLog&quot; and &quot;templates_c&quot; directories?</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T17:15:11.980Z
Answers.Text: Hi @demerit. Thank you so so much!
Answers.UserDisplayName: safron
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T16:57:31.360Z
Answers.LastActivityDate: 2020-06-11T16:57:31.360Z
Answers.UserDisplayName: Demerit
Body: <p>Currently, I'm developing a civi extension in a Wordpress environment. I want to add some debug lines to make sure I'm receiving the intended result from variable/function. </p>
  
  <p>I refer this <a href="https://docs.civicrm.org/dev/en/latest/tools/debugging/" rel="nofollow noreferrer">guide</a> it says the log files are saved in ConfigAndLog directory.but that directory is not available. </p>
  
  <p>I want to know how to include debug lines in the code and from where I can view the results? </p>
  
  <p>Thanks in advance!</p>
  
Tags: <wordpress><debugging>
Title: How do I add debug lines?
ThreadText: # How do I add debug lines?
  
  (Asked by: username_0 on 2020-06-11)
  
  Currently, I'm developing a civi extension in a Wordpress environment. I want to add some debug lines to make sure I'm receiving the intended result from variable/function.
  
  I refer this [guide](https://docs.civicrm.org/dev/en/latest/tools/debugging/) it says the log files are saved in ConfigAndLog directory.but that directory is not available.
  
  I want to know how to include debug lines in the code and from where I can view the results?
  
  Thanks in advance!
  
  **Tags:** wordpress, debugging
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-06-11. Score: 4 | Accepted answer
  
  At the link you referenced it says you can use `Civi::log()->debug();` [this section](https://docs.civicrm.org/dev/en/latest/tools/debugging/#viewing-log-files), so for example `Civi::log()->debug(var_export($my_variable, true));`
  
  I'm not sure what you mean by the directory isn't available? This article says how to find it: [Where are the "ConfigAndLog" and "templates\_c" directories?](https://civicrm.stackexchange.com/questions/15931/where-are-the-configandlog-and-templates-c-directories)
  
  > **Comments:**
  > **username_0**: Hi @demerit. Thank you so so much!  
  
  ---
  
  ### Answer by username_1 on 2020-06-11. Score: 3
  
  Re "where can I view the results" - if you want to view the log via the GUI try [the log viewer extension](https://civicrm.org/extensions/civicrm-log-viewer).
  
  > **Comments:**
  > **username_0**: cool. Thank you!  
  
  ---
  
  