Back_end / logger.py
Ezhil
Motified changes
35b0731
raw
history blame contribute delete
773 Bytes
# import logging
# import os
# # Create logs directory if it doesn't exist
# if not os.path.exists("logs"):
# os.makedirs("logs")
# # Configure logging
# logging.basicConfig(
# level=logging.INFO,
# format="%(asctime)s - %(levelname)s - %(message)s",
# handlers=[
# logging.FileHandler("logs/app.log"), # Log to file
# logging.StreamHandler() # Log to console
# ],
# )
# # Get logger instance
# logger = logging.getLogger("world_population")
import logging
import os
# Ensure the logs directory exists
os.makedirs("/app/logs", exist_ok=True)
# Configure logging
logging.basicConfig(
filename="/app/logs/app.log", # Ensure the path is correct
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s"
)