Skip to content

Commit

Permalink
Fix logs permission
Browse files Browse the repository at this point in the history
  • Loading branch information
D3vil0p3r committed Nov 11, 2024
1 parent 6cc73c4 commit 83ba796
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions empire/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ def setup_logging(args):

log_dir = empire_config.logging.directory

# Attempt to create the directory and handle permission issues
try:
log_dir.mkdir(parents=True, exist_ok=True)
except PermissionError:
# If PermissionError occurs, use the user's home directory for logs (fallback)
user_home = Path.home() # This gets the user's home directory
user_home = Path.home()
log_dir = user_home / ".empire" / "server" / "downloads" / "logs"
log.debug(f"Permission denied to create logs in the directory specified in the configuration file. Logs will be stored in {log_dir}")
log_dir.mkdir(parents=True, exist_ok=True) # Create the fallback directory
log_dir.mkdir(parents=True, exist_ok=True)

root_log_file = log_dir / "empire_server.log"
root_logger = logging.getLogger()
Expand Down

0 comments on commit 83ba796

Please sign in to comment.