BEST PRACTICES FOR MAGENTO DEBUGGING ERIK HANSEN | CO-FOUNDER AND DIRECTOR OF TECHNOLOGY AT CLASSY LLAMA STUDIOS.

Slides:



Advertisements
Similar presentations
MFA for Business Banking – Security Code Multifactor Authentication: Quick Tip Sheets Note to Financial Institutions: We are providing these QT sheets.
Advertisements

OpenAtrium A Drupal Distribution for Online Collaboration Bud Witney Systems Manager Horticulture & Crop Science Department.
Rev SYBASE ASE: GRAPHICAL MONITOR Sybase Administration Tools available at: mailto:
Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.
Administering Microsoft SQL Server 2012 Databases.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
1 Technology Readiness Maryland /2015 Admin Schedule 2 AssessmentOnline/CBT Testing Dates PARCC - PBAMarch 2 – May 8 MSA ScienceApril 13.
Using the Windows Event Viewer and Task Scheduler Chapter 5.
.NET Health Monitoring Jonathan Franco ITD Application Services.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
Justin Klein Keane Drupal Training Session 1 Introduction to Drupal.
By Jeerarat Boonyanit. As you can see I have chosen Cpanel for my server management tool. cPanel is a Linux based web hosting control panel that provides.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
This presentation will guide you though the initial stages of installation, through to producing your first report Click your mouse to advance the presentation.
Best Practices in Moodle Administration Best Practices in Moodle Administration A variety of topics from technical to practical Jonathan Moore Vice President.
ZFApp Preview Walkthrough. What is ZFApp? ZFApp is an application framework built on top of Zend Framework Fully compatible with the latest ZF Versions.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Chris Hyzer University of Pennsylvania
DotNetNuke v4 on ASP.NET v2 Stan Schultes Stan Schultes Enterprise architect / application developer Enterprise architect / application developer Conference.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
WaveMaker Visual AJAX Studio 4.0 Training Troubleshooting.
The Art of Debugging Shlomy Gantz 02/13/01MDCFUG.
SqlReports Dean Dahlvang PSUG-MO March About Dean Dean Dahlvang Director of Administrative Technology for the Proctor.
Hands-On Microsoft Windows Server 2003 Administration Chapter 2 Managing Windows Server 2003 Hardware and Software.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
TechEd /22/2017 5:40 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Microsoft FrontPage 2003 Illustrated Complete Finalizing a Web Site.
University of Illinois at Urbana-Champaign A Unified Platform for Archival Description and Access Christopher J. Prom, Christopher A. Rishel, Scott W.
Phone: Mega AS Consulting Ltd © 2007  CAT – the problem & the solution  Using the CAT - Administrator  Mega.
Microsoft ® Business Solutions–Navision ® 4.0 Development II - C/SIDE Solution Development Day 5.
Forensic Drupal Debugging Dan Harris daneesia on drupal.org.
What’s new in Kentico CMS 5.0 Michal Neuwirth Product Manager Kentico Software.
1 Session Number Presentation_ID © 2001, Cisco Systems, Inc. All rights reserved. Using the Cisco TAC Web Site for LAN Switching Issues Cisco TAC Web Seminar.
Reset and Recycle IIS Reset Application Pool Management Error Codes New HTTP Sub-status codes Custom/Detailed Errors Tracing in IIS7 and.
By Shanna Epstein IS 257 September 16, Cnet.com Provides information, tools, and advice to help customers decide what to buy and how to get the.
WEP Presentation for non-IT Steps and roles in software development 2. Skills developed in 1 st year 3. What can do a student in 1 st internship.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
© 2004 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice SISP 6.1 Delta Training Documentation.
1 / 61 Using the Customer Support Web Site © 2006, Universal Tax Systems, Inc. All Rights Reserved. Customer Support Site Objectives –In this chapter you.
LINCPlus Overview Complete binding preparation module includes features such as security, titles database, reports and job costing options. Integrated.
GOSS iCM Gary Ratcliffe. 2 Agenda Webinar Programme V10 Overview Version Information Supported Browsers Architectural Changes New Features.
| imodules.com Top 10 FAQ in Application Support Kelly Schmiedeler & Amber Quayle.
Unit 1 – Web Concepts Instructor: Brent Presley.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2012, April at SLAC Control System Studio Training - Alarm System.
Developer Exam Preparation Thom Robbins Bryan Soltis
Diagnosing Problems DAD5 © Copyright 2011 Mitchel Sellers – May Not Be Reused without Permission.
Authored by Frank Hamelly, Microsoft MVP Regional Chapters.
Custom Authentication Providers For DotNetNuke v5.0 Stan Schultes – Sarasota, FL Florida Community Leader
Error Handling Michael Smith President TeraTech, Inc ColdFusion, Database & VB custom development
Cool CF Debugging Shlomy Gantz 07/29/01CF_ODYSSEY.
Exploreengage elevate explore engage elevate Presented By: Laura Murphy, Turnkey Technologies.
Downloading and Installing GRASP-AF Workshop Ian Robson Information Analyst, North of England Cardiovascular Network.
Open Science Grid Configuring RSV OSG Resource & Service Validation Thomas Wang Grid Operations Center (OSG-GOC) Indiana University.
CMon Application Monitor & Exception Manager. If I use CMon what benefits do I get? You can fix the application bugs easily. Fixing the errors in a short.
How to use Drupal Awdhesh Kumar (Team Leader) Presentation Topic.
SQL Database Management
Setup a PHP + MySQL Development Environment
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Administrator Training
Microsoft FrontPage 2003 Illustrated Complete
Introduction of Week 3 Assignment Discussion
Quick Start Guide for Visual Studio 2010
Introduction to the New SSA OnePoint Online Website
Fast-Track UiPath Developer Module 2: Getting to Know UiPath Studio
Presentation transcript:

BEST PRACTICES FOR MAGENTO DEBUGGING ERIK HANSEN | CO-FOUNDER AND DIRECTOR OF TECHNOLOGY AT CLASSY LLAMA STUDIOS

OVERVIEW Environment configuration PHP debugging with Magento/Eclipse Common Magento development problems Mage::log() Quick tips

The Imagine Conference has been excellently planned, but… they made one fatal mistake… One important detail: My name is Erik Hansen

Erik != Eric

ENVIRONMENT CONFIGURATION

ENABLE DEVELOPER MODE Enable Mage::isDeveloperMode() on development and staging environments Preferably, set the MAGE_IS_DEVELOPER_MODE via.htaccess file or server configuration. Example: Alternatively, set the developer mode using conditional code in index.php:

SHOW ALL ERRORS IN DEVELOPER MODE Modify index.php with this conditional code to ensure that all errors are displayed when in developer mode:

NATIVE MAGENTO EXCEPTIONS

Links to the location the file vs. XDEBUG EXCEPTIONS Fully expanded argument variables Local variables

INSTALL XDEBUG Install Xdebug (an Apache module) on your development/staging serversXdebug My recommended xdebug configuration values:

Modify the Mage::run() method to not catch exceptions if developer mode is on (blog post explaining how to make this modification: MODIFY THE Mage CLASS

Modify the Mage_Core_Model_App::setErrorHandler() method to not set an error handler if developer mode is on (blog post explaining how to make this modification: ) MODIFY THE Mage_Core_Model_App CLASS

CONFIGURE EXCEPTION HANDLER TO REPORTS ON A PRODUCTION SITE Optimize the way that exceptions are handled on a production site Configure Magento to send upon every exception

PHP DEBUGGING WITH MAGENTO/ECLIPSE

BASIC XDEBUG/ECLIPSE SETUP Xdebug – Use config setting from previous slide Eclipse – Follow configuration instructions below:

Link to video:

COMMON MAGENTO DEVELOPMENT PROBLEMS

UNCOVER THE SOURCE OF SQLSTATE ERRORS What do you do when Magento throws a generic SQLSTATE database error?

UNCOVER THE SOURCE OF SQLSTATE ERRORS Example log file from SQLSTATE error SQL error message Faulty SQL query Backtrace up to point of exception

UNCOVER THE SOURCE OF SQLSTATE ERRORS Modify Zend_Db_Adapter_Pdo_Abstract to get backtraces for single queries. Copy to app/code/local/Zend/Db/Adapter/Pdo/Abstract.php

UNCOVER THE SOURCE OF SQLSTATE ERRORS Modify Zend_Db_Statement_Pdo to get backtraces for transactional query errors Copy to app/code/local/Zend/Db/Adapter/Pdo/Abstract.php

Problem: You’ve created a basic skeleton of a module with a module xml file, config.xml file, layout file, and block, but the module isn’t showing. Here are some quick steps you can take to debug the issue: THINGS TO CHECK WHEN A CUSTOM MODULE DOESN’T LOAD

DEBUGGING BY PROCESS OF ELIMINATION Problem: You are working on a site with 5 third-party modules and 9 custom modules. You’ve heavily modified the way that products work in the system. You run into an error where products aren’t saving from the admin. You can either: Work backward by reading code OR: Isolate the issue by disabling modules

DEBUGGING BY PROCESS OF ELIMINATION Disable all custom modules, then selectively re-enable modules until you’ve found the problematic module

DEBUGGING BY PROCESS OF ELIMINATION Once the offending module is identified, comment out sections of config.xml to determine component that is causing the error

VAGUE ERROR MESSAGE Problem: Your client tries to place an order in the admin. When doing so, they get a generic error message about the “The product could not be found”. You check the error and exception logs, but you have nothing to work with. What do you do?

DISABLING A MODULE VS DISABLING BLOCK OUTPUT VS

WHEN COLLECTIONS DON’T LOAD THE ITEMS YOU WANT $collection->load(true, true); logs the query to system.log and prints it to screen You can then use that query in a SQL tool to see why items aren’t loading Reference this Knowledge Base article for tips on collections:

A MODEL/BLOCK/HELPER REWRITE WON’T WORK… Is another module trying to override the same model/block/helper that you’re trying to override?

MAGE::LOG

USING MAGE::LOG – BASIC EXAMPLE Logging is disabled by default. Enable it in Configuration > Developer > Log Settings Mage::log() allows you to log code to either the default var/logs/system.log file, or a custom file. Message gets logged to var/logs/customfile.log

USING MAGE::LOG – NOTIFICATIONS/ERROR NOTICES

USING MAGE::LOG – LOGGING API RESPONSES View XML/CGI responses from API calls, like shipping quote requests

USING MAGE::LOG –DETERMINE CODE COVERAGE Find out if a certain line of code is getting reached. Alternative to using debugger.

USING MAGE::LOG – VIEWING LOG DATA You can monitor the contents of the log files using: Command-line: tail –f OS X: Console.app (Must have developer tools installed) Windows: Baretail ( )

QUICK TIPS

CHECK THE BUG TRACKER / FORUMS Someone may have already solved your problem If the bug tracker has marked an item as resolved, look in the comments for a code patch, or the SVN trunk

WILL A NEWER VERSION OF MAGENTO FIX THE ISSUE AT HAND? Setup upgrade environment and do a quick upgrade to latest production release to see if that solves the issue

ISOLATE CODE IN A “SANDBOX.PHP” FILE Allows you to run code outside of the context of a controller/page Copy index.php to sandbox.php Modify Mage::run to Mage::app

GENERAL ADVICE Don’t get stuck in a certain way of solving problems. Read (and understand) the code Before delving into a problem headlong, take a step back and think holistically about the problem

QUESTIONS?

VARIEN_PROFILER

OPTIMIZING BUGGY/SLOW CODE W/ VARIEN_PROFILER Find out what events are getting triggered on a page How many times is your custom code running? Optimize slow code

STANDARD MAGENTO PROFILE (OUTPUT IN HTML TABLE) You must enable profiler in System > Configuration > Developer > Profile

CUSTOM MAGENTO PROFILE (OUTPUT TO LOG FILE)

Modify index.php Profile gets logged to var/log/profiler.log

CUSTOMIZED PROFILE THAT EXTENDS NATIVE PROFILE WITH MYSQL QUERIES Read about how to implement this on Branko Ajzele’s blog:

CONCLUSION Questions / Thoughts / Job Inquiries: Code samples referenced in slides available here: Eclipse walkthrough video: