SlideShare a Scribd company logo
1 of 20
Download to read offline
Let's Debug
Django like pro
Backend Engineer @Continual Engine
Open source contributor | Mentor | Building tech communities ()
AGENDA
Debugging Techniques
What is Logging ?
Print Vs Logger
Deep diving into Logger
Configuring with Django
settings.py
Developing a visualisation using
logger data
Conclusion
Let's Begin!
DEBUGGING
TECHNIQUES
Using output statements
Using Flags
Comments
Brute Force
Using Debugging Tools 
Identify -> Analyze -> Remove
LOGGING AND
LOGGER
Logging is basically tracking events once
a code/software runs. It is very essential
for debugging your software
Maintaining a log file helps is fixing
crashes faster
Logger is a built-in python module that
allows debugging and recording status
messages
Print statements works for
small scale 
With Print statements it's
difficult to control the log
information one want to
capture
Cannot map the severity level
with print statements
Cannot map the timestamp
with the message emitted    
PRINT VS LOGGER
Deep Dive into Logger (04 Pillars)
FILTER
Filters provide a finer grained facility
for determining which log records to
output
LOGGER
A logger is the entry point into the
logging system.
A logger is configured to have a log
level
FORMATTER
Specifies layer/entities of record in
the output
HANDLER
Handler defines the destination of
the log record
For example - To a file, Console
MORE ABOUT LOGGER
LEVELS
DEBUG - Information used for debugging purposes 
INFO - General message
WARNING - Information used for Minor fault occurrence
ERROR - Information used for Major problem occurrence
CRITICAL - Information used for Critical issue occurrence
EXAMPLE USAGE
DEBUG - logger.debug() 
INFO - logger.info()
WARNING - logger.warning()
ERROR - logger.error()
CRITICAL - logger.critical()
BUILDING LOGGER IN
DJANGO
S T E P B Y S T E P
BASIC CONFIGURATION
(SETTINGS.PY)
integer-> representing the schema version
configures root/parent logger to log all the
messages in console level with level DEBUG
or higher
ADVANCE CONFIGURATION
App level -planets is the name of
the app
file path 
Defining formatter
formatter call
D I F F I C U L T Y
Presentations are
communication tools
that can be used as
demonstrations.
I N T E R E S T
Presentations are
communication tools
that can be used as
demonstrations.
A P P L I C A T I O N
Presentations are
communication tools
that can be used as
demonstrations.
R E T E N T I O N
[18/Apr/2020 21:58:55] INFO [planets.views:19]
['Mercury', 'Venue', 'Earth', 'mars']
Output of logger
Instance of a logger with default
__name__
creating a log
LOGGER FILE PREVIEW
DEVELOPING
INSIGHTS FROM
LOGGER FILE
GETTING OUR DATA READY
S T O R E D A T A
I N D E S I R E D
F O R M A T
tail -f
/tmp/debug.log
>out.txt
C O N V E R S I O N
To CSV/TSV etc
C H O O S E
T H E D A T A
P O I N T S
B U I L D ( ^ _ ^ )
I N S I G H T F U L
V I S U L I Z A T I O N
BAR GRAPH - LOGGING LEVEL VS FREQUENCY
DIVING INTO CODE
THAT'S NOT ALL!
T H E R E A R E E N D L E S S P O S S I B I L I T I E S ^ @ , @ ^  
THANK YOU SO MUCH :)
@SAYABANIK

More Related Content

Similar to stackconf 2020 | Let’s Debug Django like pro by Sayantika Banik

UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON Nandakumar P
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answersmkengkilili2011
 
Where's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind PloneWhere's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind PloneVincenzo Barone
 
Reverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentalsReverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentalsEran Goldstein
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android晓东 杜
 
DotDotPwn v3.0 [GuadalajaraCON 2012]
DotDotPwn v3.0 [GuadalajaraCON 2012]DotDotPwn v3.0 [GuadalajaraCON 2012]
DotDotPwn v3.0 [GuadalajaraCON 2012]Websec México, S.C.
 
Introduction to Python Basics Programming
Introduction to Python Basics ProgrammingIntroduction to Python Basics Programming
Introduction to Python Basics ProgrammingRaveendra R
 

Similar to stackconf 2020 | Let’s Debug Django like pro by Sayantika Banik (20)

11i Logs
11i Logs11i Logs
11i Logs
 
Ab initio training Ab-initio Architecture
Ab initio training Ab-initio ArchitectureAb initio training Ab-initio Architecture
Ab initio training Ab-initio Architecture
 
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
 
Logging
LoggingLogging
Logging
 
Log4j in 8 slides
Log4j in 8 slidesLog4j in 8 slides
Log4j in 8 slides
 
cblm-java-prog-ds
cblm-java-prog-dscblm-java-prog-ds
cblm-java-prog-ds
 
Python introduction
Python introductionPython introduction
Python introduction
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Where's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind PloneWhere's the source, Luke? : How to find and debug the code behind Plone
Where's the source, Luke? : How to find and debug the code behind Plone
 
Chapter_01_Intro to_Airflow.pdf
Chapter_01_Intro to_Airflow.pdfChapter_01_Intro to_Airflow.pdf
Chapter_01_Intro to_Airflow.pdf
 
Reverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentalsReverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentals
 
oracle-reports6i
oracle-reports6ioracle-reports6i
oracle-reports6i
 
Python Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging modulePython Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging module
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
Guadalajara con 2012
Guadalajara con 2012Guadalajara con 2012
Guadalajara con 2012
 
DotDotPwn v3.0 [GuadalajaraCON 2012]
DotDotPwn v3.0 [GuadalajaraCON 2012]DotDotPwn v3.0 [GuadalajaraCON 2012]
DotDotPwn v3.0 [GuadalajaraCON 2012]
 
Backtrack Manual Part4
Backtrack Manual Part4Backtrack Manual Part4
Backtrack Manual Part4
 
Introduction to Python Basics Programming
Introduction to Python Basics ProgrammingIntroduction to Python Basics Programming
Introduction to Python Basics Programming
 

Recently uploaded

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 

Recently uploaded (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

stackconf 2020 | Let’s Debug Django like pro by Sayantika Banik

  • 1. Let's Debug Django like pro Backend Engineer @Continual Engine Open source contributor | Mentor | Building tech communities ()
  • 2. AGENDA Debugging Techniques What is Logging ? Print Vs Logger Deep diving into Logger Configuring with Django settings.py Developing a visualisation using logger data Conclusion
  • 4. DEBUGGING TECHNIQUES Using output statements Using Flags Comments Brute Force Using Debugging Tools  Identify -> Analyze -> Remove
  • 5. LOGGING AND LOGGER Logging is basically tracking events once a code/software runs. It is very essential for debugging your software Maintaining a log file helps is fixing crashes faster Logger is a built-in python module that allows debugging and recording status messages
  • 6. Print statements works for small scale  With Print statements it's difficult to control the log information one want to capture Cannot map the severity level with print statements Cannot map the timestamp with the message emitted     PRINT VS LOGGER
  • 7. Deep Dive into Logger (04 Pillars) FILTER Filters provide a finer grained facility for determining which log records to output LOGGER A logger is the entry point into the logging system. A logger is configured to have a log level FORMATTER Specifies layer/entities of record in the output HANDLER Handler defines the destination of the log record For example - To a file, Console
  • 8. MORE ABOUT LOGGER LEVELS DEBUG - Information used for debugging purposes  INFO - General message WARNING - Information used for Minor fault occurrence ERROR - Information used for Major problem occurrence CRITICAL - Information used for Critical issue occurrence
  • 9. EXAMPLE USAGE DEBUG - logger.debug()  INFO - logger.info() WARNING - logger.warning() ERROR - logger.error() CRITICAL - logger.critical()
  • 10. BUILDING LOGGER IN DJANGO S T E P B Y S T E P
  • 11. BASIC CONFIGURATION (SETTINGS.PY) integer-> representing the schema version configures root/parent logger to log all the messages in console level with level DEBUG or higher
  • 12. ADVANCE CONFIGURATION App level -planets is the name of the app file path  Defining formatter formatter call
  • 13. D I F F I C U L T Y Presentations are communication tools that can be used as demonstrations. I N T E R E S T Presentations are communication tools that can be used as demonstrations. A P P L I C A T I O N Presentations are communication tools that can be used as demonstrations. R E T E N T I O N [18/Apr/2020 21:58:55] INFO [planets.views:19] ['Mercury', 'Venue', 'Earth', 'mars'] Output of logger Instance of a logger with default __name__ creating a log
  • 16. GETTING OUR DATA READY S T O R E D A T A I N D E S I R E D F O R M A T tail -f /tmp/debug.log >out.txt C O N V E R S I O N To CSV/TSV etc C H O O S E T H E D A T A P O I N T S B U I L D ( ^ _ ^ ) I N S I G H T F U L V I S U L I Z A T I O N
  • 17. BAR GRAPH - LOGGING LEVEL VS FREQUENCY
  • 19. THAT'S NOT ALL! T H E R E A R E E N D L E S S P O S S I B I L I T I E S ^ @ , @ ^  
  • 20. THANK YOU SO MUCH :) @SAYABANIK