Building Your Startup: Error Logging

Final product image
What You’ll Be Creating

This tutorial is part of the Building Your Startup With PHP series on Envato Tuts+. In this series, I’m guiding you through launching a startup from concept to reality using my Meeting Planner app as a real-life example. Every step along the way, I’ll release the Meeting Planner code as open-source examples you can learn from. I’ll also address startup-related business issues as they arise.

Introduction to Error Logging 

Once Meeting Planner went into alpha release and people began actively using it to schedule meetings, errors would occur that were rarely reported by users. But, in conversations on the phone with people, they’d commonly tell me about problems they ran into.

In today’s tutorial, I’ll walk you through how I tried two different cloud-based logging services, Rollbar and Sentry, and why I ultimately settled on Sentry for the time being.

If you haven’t tried out Meeting Planner yet, go ahead and schedule your first meeting. I do participate in the comment threads below, so tell me what you think! You can also reach me on Twitter @reifman. I’m especially interested if you want to suggest new features or topics for future tutorials.

As a reminder, all of the code for Meeting Planner is written in the Yii2 Framework for PHP. If you’d like to learn more about Yii2, check out our parallel series Programming With Yii2.

Let’s begin.

My Experience With Rollbar

Building Startups Logging - Rollbar Home Page

Both Rollbar and Sentry were recommended to me by Alex Makarov, one of the lead volunteer developers behind the Yii Framework. Alex has been very helpful to me expanding my expertise about Yii2 while I’m building Meeting Planner and writing about the benefits of the framework.

Initially, I thought about creating a secondary database connection to log my errors and tracking them manually. But then, I noticed that these services provided a lot of advanced reporting functionality. For example, they count the number of identical errors and report them by severity. At some point, I’ll write a more general-purpose Yii2 error logging tutorial for the Yii programming series, but for now, I just dove in.

And, while I got the basics working use some open-source Yii2 plugins (there are several) for Rollbar. I started having production errors that actually were caused by the plugins.

Building Startups Logging - Rolbar Integrate Your PHP Application

Overall, I was very impressed with Rollbar’s web user interface and services. But I believe some problem with my configuration and the open-source Yii extension led to new problems. 

Building Startups Logging - Rollbar List of Errors

In other words, people were seeing production errors due to my attempts at recording other errors. It was worsening people’s impression of Meeting Planner. Even I was running into newly mysterious production errors—and it was confusing and wasting my time.

In order to optimize their experience and my time, I disabled the error handling temporarily and decided to try using Sentry.

Just to be clear, I think with a better Rollbar Yii2 extension and more careful configuration (which is never documented well with third-party plugins like these), the service would have worked well. I don’t want to discourage you from trying it.

Getting Started With Sentry

Sentry is a comparable logging service, though less expensive than Rollbar. Lower cost is often helpful to startups. 

Building Startups Logging - Sentry Home Page

You can see that their first bump in pricing begins at only $29 per month:

Building Startups Logging - Sentry Pricing Page

Signing Up

I went ahead and used the Sign Up form to get started:

Building Startups Logging - Sentry Sign Up Form

Creating a New Project

Within Sentry, I created a new project for Meeting Planner to track bugs within this domain:

Building Startups Logging - Sentry Create a New Project Form

Then, Sentry offers you guides for a number of languages and frameworks (Yii is not included yet, hint to Sentry team!):

Building Startups Logging - Sentry Configure Your Application Guide

Configuring a Yii2 Sentry Plugin

For Meeting Planner, I chose to use the Notamedia Yii2 Sentry extension. I ran into a couple of minor issues that slowed me down.

The First Problem—Not the Plugin’s Fault

Firstly, I had trouble finding my unique authorization codes for my site to identify itself to Sentry. Usually, web services make these very easy to find, but it took me about 10 to 15 minutes to find.

Near the bottom of the left-hand menu of the Settings page, there’s a Client Keys (DSN) option which displays them:

Building Startups Logging - Sentry Client Keys DSN

I broke the keys into their three parts and placed them in my mp.ini file for all of Meeting Planner’s keys:

Within /frontend/config/main.php, I updated the plugin’s recommended settings to use my specific variables from mp.ini. They begin below with $config:

The Second Problem

Then, I couldn’t get Sentry to capture the error reports. It turned out that the documentation for notamedia’s plugin used the URL sentry.com instead of sentry.io. Luckily, I figured that out within just a few minutes and didn’t waste too much time.

Sentry Introductory Emails

Sentry does send you an introductory email, but I didn’t notice it arrive until later. Still, it’s very helpful:

Building Startups Logging - Welcome to Sentry Email

Testing Sentry With Meeting Planner

On one of my controllers in my local environment, I just added the code to actionIndex which would load when I load a page on the site:

Very quickly, bug reports started rolling in from the local and production environment. They land in the Sentry dashboard. 

The Sentry Dashboard

Building Startups Logging - The Sentry Dashboard

Here’s an example of the reporting for one of my fake testing bugs, “We have a problem Portland.” It shows all the helpful data that Sentry collects for you to make discovering, identifying and debugging production errors easier:

Building Startups Logging - Sample Error Report in Sentry We have a problem Portland

Above, you can see tags related to URLs and the user’s browser. Below, the report continues showing you the lines of code that caused the error:

Building Startups Logging - 2nd Segment of Sample Error

It also shows cookies above and headers and user IDs below:

Building Startups Logging - 3rd Segment of Sample Error

It’s all very helpful.

Sentry Email Alerts to New Bugs

By default, Sentry also emails you bugs (so you know about them immediately):

Building Startups Error Logging - Sentry Email Bug Report

In fact, very quickly, Sentry showed me that WordPress hacker bots were already pinging for wp-login and wp-admin on my site. Even though they don’t exist here, I want to minimize their impacts. So I added a neverland action in the front-end SiteController.php to just end the application execution.

Sentry also found a permission problem that was occurring with caching in my background tasks. This too was helpful.

For now, I’m sold on Sentry, and I look forward to some quick gains from it as it’s live in production during the ongoing preview release.

What’s Next?

I hope you’ve enjoyed learning about production error handling and logging.

Watch for upcoming tutorials here in the Building Your Startup With PHP series. I’ve done a lot of feature development and polishing this year. Now, it’s time to get people using Meeting Planner. Soon, I’ll write about promotion plans for the preview release—it’s another key element of launching your startup.

If you haven’t yet, please try out scheduling and share Meeting Planner with your friends. As usual, I’d appreciate it if you share your experience below in the comments, and I’m always interested in your suggestions. You can always reach me on Twitter @reifman directly.

I’m also getting closer to launching the experiment with WeFunder based on the implementation of the SEC’s new crowdfunding rules. You can follow our profile there if you’d like. I will also write more about this in a future tutorial.

Related Links


Source: Nettuts Web Development

Acuity Scheduling’s Developer-Friendly Scheduling Service

Final product image
What You’ll Be Creating

Introduction

Welcome! Today, I’ll be introducing you to Acuity Scheduling as the first of what will be a multipart series. Acuity is unique as an appointment scheduling and booking service in that it offers a broad suite of developer integrations and API.

In fact, Acuity Scheduling may be the most developer-friendly scheduling solution. It offers mobile app and website embedding to add its scheduling features to your own public-facing apps and sites. Alternately, you can create your own scheduling UX using its appointment scheduling API. It also offers real-time notifications and OAuth2 integration to allow you to build a complete solution for your needs around their system.

In today’s tutorial, I’ll provide an introduction to Acuity’s consumer-facing services so you understand more about what their product does. Then, I’ll outline features of their developer platform and delve deeper into them in subsequent episodes.

Before I get started, I want to encourage you to reach out with any questions you may have about the tutorial. Post them in the comments below or to me @jeffreifman on Twitter.

Acuity’s Calendar and Appointment Booking

First, let’s look at Acuity’s scheduling service. Its breadth and depth is impressive.

Registration and Welcome Guide

Signup is simple and straightforward:

Acuity Scheduling Developers - Sign up

There’s a great Welcome Guide to help orient you to the services. Notice that Acuity allows scheduling and booking for multiple people. Below, I’m adding a separate colleague to schedule with named Rod U:

Acuity Scheduling Developers - Welcome guide

The Welcome Guide helps with each of the major areas:

Acuity Scheduling Developers - Set up your Calendar Availability

Set Up Your Calendar Availability 

Acuity allows you to set up a regular schedule, for you and other people, offer ad hoc appointments, or block out time for bookings.

Here’s an example of me setting up my weekly hours:

Acuity Scheduling Developers - Set up your Calendar Availability  Blocking

But as you add more people to your team, Acuity provides scheduling, blocking and booking for everyone:

Acuity Scheduling Developers - Multiple people and team calendar scheduling

Create Your Appointment Types

This depends on your profession and what you’re scheduling, from General Visit for a pet to see a vet, to massage appointments, to salon bookings.

Here’s me setting up a consulting hour appointment:

Acuity Scheduling Developers - Creating your Appointment Types

Here’s an example of a yoga studio offering a complex variety of series:

Acuity Scheduling Developers - Appointment Type Variety

Once you begin using Acuity, you’ll discover how broadly it meets your calendar customization and appointment booking needs.

Customize Your Client’s Scheduling Page

Acuity provides a mini-content management system or UX to help you design your public-facing appointment scheduling site:

Acuity Scheduling Developers - Customize your Clients Scheduling Page

Here’s what the example Yoga Studio scheduling page looks like with its logo, appointments, and chosen text:

Acuity Scheduling Developers - example Yoga Studio scheduling page

Sync With Other Calendars

Of course, Acuity allows you to synchronize a variety of commonly used calendar services with your availability and appointment bookings such as Google Calendar, iCloud, and Outlook:

Acuity Scheduling Developers - Calendar Sync

If you’d like to see more, watch Acuity’s Client Scheduling video below:

 

As space is limited here, I encourage you to sign up at Acuity and explore more on your own. But now, let’s dive into Acuity’s developer portal.

Acuity’s Developer Services

Acuity Scheduling Developer Hub APIs et al

Acuity’s Developer Hub offers a broad variety of integration for your calendar, scheduling, and appointment booking needs. 

Today, I’m just providing a basic summary of the key areas; I’ll dive deeper and more specifically into each area in the upcoming episodes.

Major Acuity Scheduling API Capabilities

Embedding

Acuity embedding makes it easy for your clients to schedule appointments through your mobile app and/or website. Learn more here.

Acuity Scheduling Developers - Embedding

Appointment Scheduling API

You can design your own scheduling extension to your application using Acuity’s appointment scheduling API, focusing on what you do best and connecting it to a sophisticated calendar scheduling platform.

They provide excellent documentation:

Acuity Scheduling Developers - API Quickstart

And they include interactive examples for all of their methods:

Acuity Scheduling Developers - API Appointments Method

OAuth2 Integration

If you’re developing an application where many different users on Acuity need to authenticate, Acuity provides an OAuth2 implementation:

Acuity Scheduling Developers - OAuth2 Support

Notifications via Webhooks

Acuity provides your application real-time notifications as people schedule, cancel and reschedule bookings:

Acuity Scheduling Developers - Webhooks for Notifications

Acuity has a lot to offer. I look forward to sharing examples of Acuity’s powerful developer features in future tutorials.

In Closing

I hope you’ve enjoyed our first episode introducing Acuity Scheduling and its appointment booking and calendar developer platform. 

Please let us know which areas you’d like to see covered in more detail in upcoming episodes. Post your ideas and questions in the comments below or reach me on Twitter @jeffreifman.

If you liked this tutorial, please be sure to check out my Envato Tuts+ instructor page to see some of my other tutorials and series, including the startup series which focuses on building a service that tends to the social aspects of scheduling get-togethers.

Related Links


Source: Nettuts Web Development

New Short Course: Essential Gulp Tasks

Gulp is a build system for JavaScript that makes it easy to automate repetitive tasks like linting, minification, and transcoding.

In our new short course, Essential Gulp Tasks, you’ll learn how to set up Gulp to perform some key build tasks for your JavaScript apps. 

Screenshot from Essential Gulp Tasks course

What You’ll Learn

In this course, Envato Tuts+ instructor Dan Wellman will show you some essential tools for modern front-end development. You’ll learn how to install and configure them as Gulp tasks to create a basic but robust JavaScript build system.

The course covers file linting, code style enforcing, building and compiling, and unit testing.

Code from  Essential Gulp Tasks course

Watch the Introduction

 

Take the Course With a Free Trial

You can take our new course straight away with a free 10-day trial of our monthly subscription. If you decide to continue, it costs just $15 a month, and you’ll get access to hundreds of courses, with new ones added every week.

You can also find hundreds of useful JavaScript plugins on Envato Market to make your JavaScript development work more efficient and productive.


Source: Nettuts Web Development