Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Dependency Management Autoloading

Using Vagrant for this and getting duplicate logs.

Copied this code to workspace and message is only logged once. Any thoughts/suggestions? It's an otherwise empty site, created for this course.

index.php:

<?php
require __DIR__ . '/vendor/autoload.php';
echo 'Monolog';

$log = new Monolog\Logger( 'name' );
$log->pushHandler( new Monolog\Handler\StreamHandler( 'app.log', Monolog\Logger::WARNING) );
$log->addWarning('Foo');
===================================================
app.log:

[2015-09-04 17:40:08] name.WARNING: Foo [] []
[2015-09-04 17:40:09] name.WARNING: Foo [] []

formatted code.

2 Answers

I don't know why you have that. I would have to run the code myself and see what happens. Is that on Workspaces? If so, create a snapshot by clicking the camera icon and following the steps until you can copy and paste the url here.

Edit: I reread your post about one log in Workspaces. I know nothing about Vagrant, so I cannot help you. It has to be making 2 calls, though.

Autoloading has changed: https://getcomposer.org/doc/01-basic-usage.md#autoloading

Could this be the source of the issue?

I am also experiencing it

EDIT: I'm sorry I am mistaken. I am not experiencing this issue. The change to autoload does not affect this whatsoever