File size: 773 Bytes
35b0731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f67a585
 
 
35b0731
 
f67a585
 
 
35b0731
f67a585
35b0731
f67a585
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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"
)