シムノート

PHPフレームワークSymfonyの学習帳

ユーザ用ツール

サイト用ツール


サイドバー

メニュー



このエントリーをはてなブックマークに追加

blog:2015-12-07:デバッグ

デバッグ

シンプルで便利なデバッグ方法を3つ紹介します。

  • Profiler
  • Dump
  • Logger

Profiler

画面の下に表示されているやつです。

profiler_bar.jpg

展開すると各種情報が見れます。

profiler.jpg

Dump

dump()でオブジェクトのダンプが見れます。var_dump()はもう必要ありません。

    public function indexAction(Request $request)
    {
        dump($request);

        return $this->render('default/index.html.twig', array(
            'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..'),
        ));
    }

ダンプはプロファイラーバーで見れます。

profiler_dump1.jpg

プロファイラーを展開した中でも見れます。

profiler_dump2.jpg

dumpの後で、dieやexitすると、その場でブラウザ画面に表示されます。

    public function indexAction(Request $request)
    {
        dump($request);
        die;

        return $this->render('default/index.html.twig', array(
            'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..'),
        ));
    }

profiler_dump3.jpg

dumpはtwigの中でも使えます。

{# app/Resources/views/article/recent_list.html.twig #}

{{ dump(articles) }}

{% for article in articles %}
    <a href="/article/{{ article.slug }}">
        {{ article.title }}
    </a>
{% endfor %}

Logger

Loggerでファイルにログを出力することができます。

    public function indexAction(Request $request)
    {
        $logger = $this->get('logger');
        $logger->info("incoming ".__METHOD__);

        return $this->render('default/index.html.twig', array(
            'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..'),
        ));
    }

$ tail -f var/logs/dev.log | grep app.INFO

[2015-12-09 00:12:39] app.INFO: incoming AppBundle\Controller\DefaultController::indexAction [] []

ログはプロファイラーで見ることもできます。

profiler_log.jpg

ダンプやログもプロファイラーから見ることが出来るSymfonyはとても親切です。

Comments

homeowners insurance quotes <a href=“https://homeownersinsurancequotes.us.com

>homeowners insurance quotes</a> homeowners insurance quote [url=https://homeownersinsurancequotes.us.com]renters insurance for college students[/url]

1 |
universal insurance
| 2018/10/03 09:39 | reply

cash advance usa <a href=“https://advance.us.org

>cash advance loan</a> cash advance usa [url=https://advance.us.org]express cash advance[/url]

2 |
Best Online Loans
| 2018/10/03 17:23 | reply

viagra order <a href=“http://genericonlineviaqra.com/

>buy generic viagra online</a> buy generic viagra <a href=http://genericonlineviaqra.com/>canadian online pharmacy viagra</a>

3 |
oxnChoda
| 2018/10/04 06:44 | reply

auto and home insurance quotes <a href=“https://carinsurancecheap.us.com

>cheap car insurance in michigan</a> best car insurance companies [url=https://carinsurancecheap.us.com]cheap insurance quotes[/url]

4 |
accurate automotive
| 2018/10/06 19:00 | reply

loans <a href=“https://loans2019.us.com/

>unsecured loan</a> loans [url=https://loans2019.us.com/]real online payday loans[/url]

5 |
Cash Loan
| 2018/10/22 15:37 | reply

online payday loan <a href=“https://paydayloans2018.com/

>payday loans</a> payday loans [url=https://paydayloans2018.com/]payday loans online[/url]

6 |
Fastest Payday Loan
| 2018/10/23 22:19 | reply

best place to get a personal loan <a href=“https://personalloans2019.com/

>personal loans</a> personal loans [url=https://personalloans2019.com/]personal loans[/url]

7 |
Online Lenders
| 2018/10/24 03:03 | reply

loan for debt consolidation <a href=“https://personalloans2019.com/

>personal loans</a> personal loans [url=https://personalloans2019.com/]personal loan[/url]

8 |
Quick Loans
| 2018/10/24 03:18 | reply

pay day loans <a href=“https://paydayloans2018.com/

>payday loan online</a> cashusa [url=https://paydayloans2018.com/]payday loans[/url]

9 |
Speedycash
| 2018/10/25 09:08 | reply

payday loans <a href=“https://paydayloans2018.com/

>money lending</a> payday loans no credit [url=https://paydayloans2018.com/]payday loans online no credit check[/url]

10 |
Loans
| 2018/10/26 12:09 | reply

loans for bad credit <a href=“https://loansforbadcredit2018.com/

>unsecured loans for bad credit</a> no hassle loans [url=https://loansforbadcredit2018.com/]loans for bad credit[/url] quick loans online <a href="https://loansonline2018.com/">loans online no credit check</a> loans online direct [url=https://loansonline2018.com/]loans online direct[/url] credit loans guaranteed approval <a href="https://creditloansguaranteedapproval2018.com/">bad credit loans guaranteed approval</a> online loans with monthly payments [url=https://creditloansguaranteedapproval2018.com/]poor credit loans guaranteed approval[/url] loans today <a href="https://loans1000.com/">loan site</a> 1000 cash loan [url=https://loans1000.com/]loans today[/url] installment loans online <a href="https://installmentloans2018.com/">installment loans</a> installment loans [url=https://installmentloans2018.com/]online installment loans[/url] cash advance <a href="https://cashadvance911.com/">payday cash advance</a> express cash advance [url=https://cashadvance911.com/]cash advances[/url] payday loans no credit check <a href="https://paydayloansnocreditcheck2018.com/">best loan consolidation</a> online installment loans for bad credit [url=https://paydayloansnocreditcheck2018.com/]loans las vegas[/url] small personal loans with bad credit <a href="https://personalloansforbadcredit2018.com/">personal loans for people with bad credit</a> personal loans with bad credit [url=https://personalloansforbadcredit2018.com/]small personal loans with bad credit[/url] online loans <a href="https://onlineloans2018.com/">best online loans</a> best online loans [url=https://onlineloans2018.com/]borrow money fast[/url] get cash fast <a href="https://onlinepaydayloans2018.com/">online payday loans</a> same day cash loans [url=https://onlinepaydayloans2018.com/]online payday loans[/url]

11 |
Quick Loan
| 2018/10/27 11:27 | reply

bad credit lenders <a href=“https://cashadvance911.com/

>express cash advance</a> express cash advance [url=https://cashadvance911.com/]cash advance[/url]

12 |
Online Loans
| 2018/10/27 18:18 | reply

write an essay for me <a href=“https://writemyessay2018.com/

>write my essays</a> write my essay [url=https://writemyessay2018.com/]write my essay[/url]

13 |
Help With My Essay
| 2018/10/27 21:13 | reply

generic viagra india <a href=“https://www.purseinstock.com/

>viagra online usa</a> viagra alternatives <a href=https://www.purseinstock.com/>viagra online prescription free</a>

14 |
bsfillex
| 2018/10/28 00:30 | reply

auto loan <a href=“https://autoloan2018.com/

>bad credit auto loans guaranteed approval</a> auto loan [url=https://autoloan2018.com/]auto car loan[/url] car loan interest <a href="https://carloan2018.com/">car loan</a> classic car loans [url=https://carloan2018.com/]car loan[/url]

15 |
car finance
| 2018/10/28 20:36 | reply

1000 online payday loan <a href=“http://cashmojoloan.com/

>cash advances</a> payday loans cash advances <a href=http://cashmojoloan.com/>advance america</a>

16 |
bsfHoify
| 2018/10/29 18:46 | reply

car loans bad credit <a href=“http://instantpaydayloanscentral.com/

>payday loan online</a> card consolidate credit debt <a href=http://instantpaydayloanscentral.com/>Easy Payday Loan</a>

17 |
nsfElelm
| 2018/10/30 06:31 | reply

personal loans online <a href=“https://loansonline2018.com/

>emergency loans for bad credit</a> loans online payday [url=https://loansonline2018.com/]no fax payday loan[/url] personal loans with low interest <a href="https://loans1000.com/">loans</a> pay loans [url=https://loans1000.com/]payday loans guaranteed approval[/url] loans for bad credit <a href="https://loansforbadcredit2018.com/">loans for bad credit</a> loans for bad credit [url=https://loansforbadcredit2018.com/]loans for people with bad credit[/url]

18 |
Personal Loans
| 2018/10/31 13:00 | reply

online payday loans <a href=“https://onlinepaydayloans2018.com/

>payday loans dallas</a> online payday loans no credit check [url=https://onlinepaydayloans2018.com/]payday loans online[/url] guaranteed payday loan approval <a href="https://creditloansguaranteedapproval2018.com/">bad credit loans guaranteed approval</a> quicken loans arena [url=https://creditloansguaranteedapproval2018.com/]poor credit loans[/url] 1000 loan <a href="https://loans1000.com/">bitcoin cash price now</a> discover personal loans [url=https://loans1000.com/]loans with low interest[/url]

19 |
Quick Loans
| 2018/11/01 00:25 | reply

bad credit debt consolidation internet payday loan student <a href=“http://willpaydayloans.com/

>2nd payday loan</a> 1 hour payday loans <a href=http://willpaydayloans.com/> 1000 no fax payday loan</a>

20 |
pljFrepe
| 2018/11/01 18:44 | reply

auto loan <a href=“https://autoloan2018.com/

>auto loan</a> car dealerships that work with bad credit [url=https://autoloan2018.com/]automobile[/url]

21 |
auto lenders
| 2018/11/03 15:01 | reply

payday advance cash america <a href=“http://usconstitutionof1777.com/

>cash advance</a> all payday loan companies <a href=http://usconstitutionof1777.com/> bad credit loans</a>

22 |
sfrHoify
| 2018/11/03 15:07 | reply

no credit loans <a href=“https://nocredit.us.com/

>loan scandal</a> loan no credit [url=https://nocredit.us.com/]no credit loans[/url] payday advance <a href="https://paydayadvance2018.com/">how does debt consolidation work</a> payday advance [url=https://paydayadvance2018.com/]advance loans[/url] direct loans <a href="https://loans.us.org/">online payday loans</a> loans [url=https://loans.us.org/]loans for fair credit[/url] loan with bad credit <a href="https://loanswithbadcredit2018.com/">loans with bad credit</a> a loan with bad credit [url=https://loanswithbadcredit2018.com/]advance payday[/url] payday loans online <a href="https://paydayloansonline2018.com/">same day payday loans no credit check</a> same day payday loans no credit check [url=https://paydayloansonline2018.com/]credit builder loans[/url] best payday loans online <a href="https://bestpaydayloansonline.us.com/">quick cash payday loans</a> best payday loans [url=https://bestpaydayloansonline.us.com/]reputable payday loan companies[/url] payday <a href="https://payday.us.com/">payday</a> easy loans no credit check [url=https://payday.us.com/]ez cash[/url] payday loans online no credit check <a href="https://paydayloans.us.org/">payday loans online no credit check</a> first loan [url=https://paydayloans.us.org/]payday loans online no credit check[/url] best loans for bad credit <a href="https://badcreditloansguaranteedapproval2018.com/">payday loan today</a> bad credit loans guaranteed approval [url=https://badcreditloansguaranteedapproval2018.com/]bad credit loans guaranteed approval[/url] loan interest rate <a href="https://onlineloansinstantapproval.us.com/">bad credit short term loans</a> unsecured loans [url=https://onlineloansinstantapproval.us.com/]payday loans instant approval[/url]

23 |
Loan Cash
| 2018/11/05 08:31 | reply

payday loans no credit check same day <a href=“https://payday.us.com/

>direct payday loans online</a> car loans [url=https://payday.us.com/]cash advance places near me[/url] payday loans online <a href="https://paydayloansonline2018.com/">instant payday loans</a> payday loans online [url=https://paydayloansonline2018.com/]payday loans no faxing[/url] best payday loans online <a href="https://bestpaydayloansonline.us.com/">best payday loans online</a> payday loans in houston [url=https://bestpaydayloansonline.us.com/]overnight payday loans[/url] no credit loans <a href="https://nocredit.us.com/">personal loan poor credit</a> loans direct lender [url=https://nocredit.us.com/]loan no credit[/url] payday advance loan <a href="https://paydayadvance2018.com/">online payday advance</a> payday advance [url=https://paydayadvance2018.com/]payday advance online[/url] short term personal loan <a href="https://badcreditloansguaranteedapproval2018.com/">bad credit loans guaranteed approval</a> bad credit loans [url=https://badcreditloansguaranteedapproval2018.com/]bad credit loans guaranteed approval[/url] what is a cash advance <a href="https://loanswithbadcredit2018.com/">loans for people with bad credit</a> loans with bad credit [url=https://loanswithbadcredit2018.com/]loans for poor credit[/url] loans with no credit check near me <a href="https://loans.us.org/">loans for fair credit</a> online payday loans instant approval [url=https://loans.us.org/]instant cash payday loans[/url] online payday loans instant approval <a href="https://paydayloans.us.org/">online payday loans</a> payday loans [url=https://paydayloans.us.org/]loans complaints[/url] no credit check payday loans <a href="https://onlineloansinstantapproval.us.com/">easy installment loans online</a> online loans instant approval [url=https://onlineloansinstantapproval.us.com/]online loans instant approval[/url]

24 |
Getting A Loan
| 2018/11/09 18:49 | reply

generic viagra online <a href=“http://usaerectionrx.com/

>viagra generic online</a> cheap generic viagra <a href=http://usaerectionrx.com/>viagra generic</a>

25 |
bdfseino
| 2018/11/10 17:34 | reply

cash payday loans <a href=“https://bestpaydayloansonline.us.com/

>best payday loans online</a> money payday loans [url=https://bestpaydayloansonline.us.com/]money payday loans[/url] legitimate online payday loans <a href="https://nocredit.us.com/">no credit loans</a> personal loans no credit [url=https://nocredit.us.com/]personal loans no credit[/url] same day payday loans <a href="https://paydayloansonline2018.com/">payday loans online</a> how to get a personal loan [url=https://paydayloansonline2018.com/]payday loans definition[/url] loans online instant approval <a href="https://onlineloansinstantapproval.us.com/">online loans for bad credit</a> loans online instant approval [url=https://onlineloansinstantapproval.us.com/]instant loans online[/url] payday advances <a href="https://paydayadvance2018.com/">advance payday loan</a> payday advance [url=https://paydayadvance2018.com/]advance payday loan[/url] advance loans <a href="https://paydayloans.us.org/">online payday loans instant approval</a> payday cash loans online [url=https://paydayloans.us.org/]payday loans near me[/url] bad credit loans guaranteed approval <a href="https://badcreditloansguaranteedapproval2018.com/">bad credit loans guaranteed approval</a> bad credit loans guaranteed approval [url=https://badcreditloansguaranteedapproval2018.com/]bad credit personal loans guaranteed approval[/url] loans with bad credit <a href="https://loanswithbadcredit2018.com/">loans with bad credit</a> payday loans new orleans [url=https://loanswithbadcredit2018.com/]loans for people with bad credit[/url] loans <a href="https://loans.us.org/">loans</a> loans for fair credit [url=https://loans.us.org/]loans direct lender[/url] no credit check payday loans <a href="https://payday.us.com/">payday loans no credit check same day</a> payday loans no credit check same day [url=https://payday.us.com/]loan no credit check[/url]

26 |
Loans
| 2018/11/11 17:34 | reply

personal loan agreement <a href=“http://onlineloansinstantapproval.us.com/

>instant loans online</a> online loans instant approval [url=http://onlineloansinstantapproval.us.com/]no credit check payday loans[/url] cash payday loans online <a href="http://paydayloans.us.org/">online loans bad credit instant approval</a> i need money now [url=http://paydayloans.us.org/]payday loans[/url] cash now <a href="http://paydayadvance2018.com/">payday cash advance</a> bad credit quick loans [url=http://paydayadvance2018.com/]payday advance[/url] loan with no credit <a href="http://loans.us.org/">low rate payday loans</a> loans for fair credit [url=http://loans.us.org/]loans[/url] green loans <a href="http://paydayloansonline2018.com/">payday loan lenders online</a> no fax payday loans [url=http://paydayloansonline2018.com/]payday loans online[/url] no credit check payday loans <a href="http://payday.us.com/">easy loans no credit check</a> payday loans no credit [url=http://payday.us.com/]signature loans online[/url] credit card debt relief <a href="http://loanswithbadcredit2018.com/">small personal loans with bad credit</a> advance loans [url=http://loanswithbadcredit2018.com/]a loan with bad credit[/url] direct lenders for payday loans 100 approved <a href="http://badcreditloansguaranteedapproval2018.com/">loan search</a> bad credit payday loans [url=http://badcreditloansguaranteedapproval2018.com/]loans bad credit[/url] best payday loans online <a href="http://bestpaydayloansonline.us.com/">payday loans in houston</a> best payday loans online [url=http://bestpaydayloansonline.us.com/]best payday loans[/url] loans with no credit <a href="http://nocredit.us.com/">personal loans no credit</a> cash loans no credit check [url=http://nocredit.us.com/]no credit loans[/url]

27 |
Payday
| 2018/11/12 18:04 | reply

cialis online no prescription <a href=“https://forumdemulheres.com/

>online cialis</a> cialis online <a href="https://forumdemulheres.com/">buy cialis</a>

28 |
nfhExoks
| 2018/11/12 18:40 | reply

loans louisiana <a href=“https://badcreditloansguaranteedapproval2018.com/

>bad credit loans guaranteed approval</a> bad credit loans guaranteed approval [url=https://badcreditloansguaranteedapproval2018.com/]bad credit loans guaranteed approval[/url] online payday loans instant approval <a href="https://paydayloans.us.org/">payday loans online no credit check</a> payday loans [url=https://paydayloans.us.org/]payday loans[/url] payday loans online <a href="https://paydayloansonline2018.com/">payday loans online</a> money right now [url=https://paydayloansonline2018.com/]instant payday loans[/url]

29 |
Online Payday Loan
| 2018/11/13 10:14 | reply

liberty mutual auto insurance <a href=“https://wellsfargoautoinsurance.com/

>buy auto insurance</a> wells fargo auto insurance [url=https://wellsfargoautoinsurance.com/]auto insurance[/url] auto owners insurance <a href="https://autoownersinsuranceonline.com/">owners insurance company</a> auto owners [url=https://autoownersinsuranceonline.com/]auto owners insurance online[/url] auto gap insurance providers <a href="https://gapinsuranceforcars.com/">aarp car insurance</a> gap insurance for cars [url=https://gapinsuranceforcars.com/]insurance quotes online[/url] usaa insurance <a href="https://usaaautoinsurancequote.com/">usaa insurance company</a> usaa auto insurance quote [url=https://usaaautoinsurancequote.com/]usaa auto insurance quote[/url]

30 |
usaa auto insurance
| 2018/11/13 11:21 | reply


184 -14 =​ ?
blog/2015-12-07/デバッグ.txt · 最終更新: 2015/12/10 01:31 by tsubo

ページ用ツール