rakshith commited on
Commit
27ac340
·
1 Parent(s): e6108ec

fixed logs thing

Browse files
Files changed (3) hide show
  1. Dockerfile +2 -2
  2. app.py +4 -8
  3. rsvp-server.py +4 -8
Dockerfile CHANGED
@@ -9,8 +9,8 @@ RUN pip install --no-cache-dir -r requirements.txt
9
  # Copy application code
10
  COPY . .
11
 
12
- # Create logs directory
13
- RUN mkdir -p logs
14
 
15
  # Expose port
16
  EXPOSE 5000
 
9
  # Copy application code
10
  COPY . .
11
 
12
+ # Create logs directory with proper permissions
13
+ RUN mkdir -p logs && chmod 777 logs
14
 
15
  # Expose port
16
  EXPOSE 5000
app.py CHANGED
@@ -10,16 +10,12 @@ from werkzeug.middleware.proxy_fix import ProxyFix
10
  logging.basicConfig(level=logging.INFO)
11
  logger = logging.getLogger(__name__)
12
 
13
- # Create logs directory if it doesn't exist
14
- if not os.path.exists('logs'):
15
- os.makedirs('logs')
16
-
17
- # Add file handler for logging
18
- file_handler = RotatingFileHandler('logs/app.log', maxBytes=10240, backupCount=10)
19
- file_handler.setFormatter(logging.Formatter(
20
  '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
21
  ))
22
- logger.addHandler(file_handler)
23
 
24
  # Initialize Flask app
25
  app = Flask(__name__)
 
10
  logging.basicConfig(level=logging.INFO)
11
  logger = logging.getLogger(__name__)
12
 
13
+ # Configure logging to console instead of file to avoid permission issues
14
+ console_handler = logging.StreamHandler()
15
+ console_handler.setFormatter(logging.Formatter(
 
 
 
 
16
  '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
17
  ))
18
+ logger.addHandler(console_handler)
19
 
20
  # Initialize Flask app
21
  app = Flask(__name__)
rsvp-server.py CHANGED
@@ -10,16 +10,12 @@ from werkzeug.middleware.proxy_fix import ProxyFix
10
  logging.basicConfig(level=logging.INFO)
11
  logger = logging.getLogger(__name__)
12
 
13
- # Create logs directory if it doesn't exist
14
- if not os.path.exists('logs'):
15
- os.makedirs('logs')
16
-
17
- # Add file handler for logging
18
- file_handler = RotatingFileHandler('logs/app.log', maxBytes=10240, backupCount=10)
19
- file_handler.setFormatter(logging.Formatter(
20
  '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
21
  ))
22
- logger.addHandler(file_handler)
23
 
24
  # Initialize Flask app
25
  app = Flask(__name__)
 
10
  logging.basicConfig(level=logging.INFO)
11
  logger = logging.getLogger(__name__)
12
 
13
+ # Configure logging to console instead of file to avoid permission issues
14
+ console_handler = logging.StreamHandler()
15
+ console_handler.setFormatter(logging.Formatter(
 
 
 
 
16
  '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
17
  ))
18
+ logger.addHandler(console_handler)
19
 
20
  # Initialize Flask app
21
  app = Flask(__name__)