HaochenGong commited on
Commit
f75ae3f
·
1 Parent(s): f7d7d05
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -21,7 +21,7 @@ description = "Automated Contextual Privacy Policies Generation for Mobile Apps"
21
 
22
 
23
  # log
24
- log_file_path = './logs/app.log'
25
  log_directory = os.path.dirname(log_file_path)
26
 
27
  if not os.path.exists(log_directory):
@@ -30,10 +30,14 @@ if not os.path.exists(log_directory):
30
  try:
31
  with open(log_file_path, 'w') as f:
32
  f.write('Test log entry')
 
 
33
  print(f"Successfully wrote to {log_file_path}")
34
  except Exception as e:
35
  print(f"Failed to write to {log_file_path}: {e}")
36
 
 
 
37
  # set log handler(Generate one log file per day and keep only the latest 7 files)
38
  handler = TimedRotatingFileHandler(log_file_path, when='W0', interval=1, backupCount=7)
39
  formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
 
21
 
22
 
23
  # log
24
+ log_file_path = './app.log'
25
  log_directory = os.path.dirname(log_file_path)
26
 
27
  if not os.path.exists(log_directory):
 
30
  try:
31
  with open(log_file_path, 'w') as f:
32
  f.write('Test log entry')
33
+ f.flush()
34
+ os.fsync(f.fileno())
35
  print(f"Successfully wrote to {log_file_path}")
36
  except Exception as e:
37
  print(f"Failed to write to {log_file_path}: {e}")
38
 
39
+
40
+
41
  # set log handler(Generate one log file per day and keep only the latest 7 files)
42
  handler = TimedRotatingFileHandler(log_file_path, when='W0', interval=1, backupCount=7)
43
  formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')