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

APVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purityAPVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purityamy56318795
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Soroosh Khodami
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAlluxio, Inc.
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationWave PLM
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...naitiksharma1124
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabbereGrabber
 
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfMicrosoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfQ-Advise
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems ApproachNeo4j
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationHelp Desk Migration
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024vaibhav130304
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesNeo4j
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdfkalichargn70th171
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...Alluxio, Inc.
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAlluxio, Inc.
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)Max Lee
 

Recently uploaded (20)

APVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purityAPVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purity
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
AI Hackathon.pptx
AI                        Hackathon.pptxAI                        Hackathon.pptx
AI Hackathon.pptx
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfMicrosoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 

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