- What is Python?
- How to Install Python?
- Python Variables and Operators
- Python Loops
- Python Functions
- Python Files
- Python Errors and Exceptions
- Python Packages
- Python Classes and Objects
- Python Strings
- PostgreSQL Data Types
- Python Generators and Decorators
- Python Dictionary
- Python Date and Time
- Python List and Tuples
- Python Multithreading and Synchronization
- Python Modules
- What is Python bytecode?
- Python Regular Expressions
Python Panda Tutorial
- Python Pandas Tutorial
- Python Pandas Features
- Advantages and Disadvantages of Python Pandas
- Pandas Library In Python
- Pandas Series To Frame
- Python Dataframeaggregate and Assign
- Pandas Dataframe Describe
- Pandas Dataframe Mean
- Pandas Hist
- Pandas Dataframe Sum
- How to convert Pandas DataFrame to Numpy array
- Pandas Concatenation
- Pandas Shift
- Pandas Rolling
- Data Analysis With Pandas and Python
- How Python Panda Are Helpful For With Data Science
- Selenium Basics
- Selenium with Python Introduction and Installation
- Navigating links using get method Selenium Python
- Locating Single Elements in Selenium Python
- Locating Multiple elements in Selenium Python
Python Flask Tutorial
- How to Install Django and Set Up a Virtual Environment in 6 Steps
- Django MTV Architecture
- Django Models
- Django Views
- Django Templates
- Django Template Language
- Django Project Layout
- Django Admin Interface
- Django Database
- Django URLs and URLConf
- Django Redirects
- Django Cookies and Cookies Handling
- Django Caching
- Types of Caching in Django
- Django Sessions
- Django Forms Handling & Validation
- Django Exceptions & Error-handling
- Django Forms Validation
- Django Redirects
- Django Admin Interface
- Django Bootstrap
- Ajax in Django
- Django Migrations and Database Connectivity
- Django Web Hosting and IDE
- Django Admin Customization
- What is CRUD?
- Django ORM
- Django Request-Response Cycle
- Django ORM
- Making a basic_api with DRF
- Django Logging
- Django Applications
- Difference between Flask vs Django
- Difference between Django vs PHP
- Numpy Introduction
- NumPy– Environment Setup
- NumPy - Data Types
- NumPy Histogram
- Matrix in NumPy
- NumPy Arrays
- NumPy Array Functions
- Matrix Multiplication in NumPy
- NumPy Matrix Transpose
- NumPy Array Append
- NumPy empty array
- NumPy Linear Algebra
- NumPy sum
- NumPy Normal Distribution
- NumPy correlation
- Why we learn and use Numpy?
- Introduction To Tensorflow
- INTRODUCTION TO DEEP LEARNING
- EXPLAIN NEURAL NETWORK?
- CONVOLUTIONAL AND RECURRENT NEURAL NETWORK
- INTRODUCTION TO TENSORFLOW
- INSTALLATION OF TENSORFLOW
- TENSORBOARD VISUALIZATION
- Linear regression in tensorflow
- Word Embedding
- Difference between CNN And RNN
- Explain Keras
- Program elements in tensorflow
- Recurrent Neural Network
- Tensorflow Object Detection
- EXPLAIN MULTILAYER PERCEPTRON
- GRADIENT DESCENT OPTIMIZATION
Interview Questions & Answers
What is Logging?
Logging is a technique or medium which can let us track some events as the software executes. It is an important technique for developers. It helps them to track events. Logging is like an extra set of eyes for them. Developers are not only responsible for making software but also for maintaining them.
Logging helps with that part of maintenance immensely.
It tracks every event that occurs at all times. That means instead of the long tracebacks you get much more. This time when an error occurs you can see in which the system was. This method will help you resolve errors quickly.
The logging is handled by a separate program. That logging program is simply a file-writer. The logger is said to record certain events in text format. The recorded information is then saved in files. The files for this are called logs.
The logs are simple files saved with log extension. They contain the logs of events occurred.
Logging Module in Python
The logging module is a built-in Python module. It comes preinstalled with Python 3. Logging module is used to keep track of the events that occur as the program runs. That can be extended to any number of programs and thus for software, it is easy to set up and use.
Why use logging module?
All logging does is writing to a file or printing it on the console. All that can be achieved by using print statements.
We use print function to output something on console. So, when a function occurs, we can get a print statement that the function executed. While that approach works with smaller applications, it is inefficient.
Print function becomes part of your program and if the software stops working, you won’t get the result.
The logging module is capable of:
- Multithreading execution
- Categorizing Messages via different log levels
- It’s much more flexible and configurable
- Gives a more structured information
The loggers are the objects that developers deal with. They can be understood as a function which will be invoked when they are called. We use loggers in our project files. Thus, when the function is invoked, we get a detailed report. The logger can generate multiple levels of responses.
Handlers are the objects which emit the information. Think of them as newspaper handlers. Their main task is to transmit the information. That can be achieved by writing the info in a log file (The default behaviour). There are various handlers provided by logging module.
We can easily set-up multiple handlers for the same logger. There are SMTP Handlers too which will mail the log records to you.
The formatters are the ones which format the data. You see handlers cannot send the information as it’s a Python data type.
The logs are by-default in Log Records format. That is the class pre-defined by logging framework. It gives various methods to developers to use.
The last piece of the logging module is filters. The filters, as the name suggests, filter the messages. Not every message we pass needs to be stored or transported. Or there can be different handlers for different messages. All that is achievable with the help of filters.
We can use filters with both loggers and handlers.
It also provides us with message levels. The message levels are defined as:
It is verbose system information when everything is running fine. It will tell you more precise details about the state of the system. Its severity point is 10.
The info will produce less verbose system information but is similar to debug. It generally tells an overview of what the system is executing. Its severity point is 20.
This contains information regarding low-level problems. The problems may be ignored as they don’t cause the system to halt. Although, it is recommended that these problems shall be resolved.
- Its severity point is 30.
This message is serious. The error will contain information about the major problem that has occurred. The problem may have stopped the operation of program and needs immediate attention.
The most critical message. This message is emitted when the problem has caused the system to stop. That means the whole application has halted due to this problem.