ich habe mir ein tutorial über logging angeschaut: https://www.youtube.com/watch?v=-ARI4Cz-awo
ich benutzte python 2.7 mit pyscripter 2.6.
im tutorial wird ein logging file erstellt, bei mir jedoch nicht.
kann mir jmd helfen, weshalb das bei mir nicht funktioniert? (--> benutzt der ne andere python version?)
mein code (wie im tutorial):
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
# DEBUG Detailed information, typically of interest only when diagnosing problems.
# INFO Confirmation that things are working as expected.
# WARNING An indication that something unexpected happened, or indicative of some problem in the near future (e.g. ‘disk space low’).
# The software is still working as expected.
# ERROR Due to a more serious problem, the software has not been able to perform some function.
# CRITICAL A serious error, indicating that the program itself may be unable to continue running.
logging.basicConfig(filename = 'Test_Logging.log', level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(message)s')
def add(x, y):
# Adding Function
return x + y
def subtract(x, y):
# Subtract Function
return x - y
def multiply(x, y):
# Multiply Function
return x * y
def divide(x, y):
# Divide Function
return x / y
num1 = 10
num2 = 5
add_result = add(num1, num2)
logging.debug("Add: {} + {} = {}".format(num1, num2, add_result))
subtract_result = subtract(num1, num2)
logging.debug("Subtract: {} - {} = {}".format(num1, num2, subtract_result))
multiply_result = multiply(num1, num2)
logging.debug("Multiply: {} * {} = {}".format(num1, num2, multiply_result))
divide_result = divide(num1, num2)
logging.debug("Divide: {} / {} = {}".format(num1, num2, divide_result)