Skip to content

Commit

Permalink
Merge pull request #10 from imubit/fix-logs-location-in-windows
Browse files Browse the repository at this point in the history
fix log files location
  • Loading branch information
cloud-rocket authored Oct 17, 2023
2 parents 36bfb17 + 4ebcac1 commit 2483ba8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/data_agent/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,15 @@ def init_configuration(is_service, loop=None, parser=None):
log.debug("Logging level is {}".format(config["log"]["level"].get(int)))

# Configure log file path
if is_service:
if (
exec_name.lower() == "pythonservice.exe"
): # We are running as a service, but not as a standalone executable
logs_dir = str(
os.path.join(os.getenv("SystemDrive"), "\\data-agent\\logs\\")
)
else: # Standalone executable service
logs_dir = str(exec_dir.joinpath("logs"))

logs_dir = None
if exec_name.lower() == "pythonservice.exe" or not os.access(
exec_dir, os.W_OK
): # We are running as a service, but not as a standalone executable
logs_dir = str(os.path.join(os.getenv("SystemDrive"), "\\data-agent\\logs\\"))
elif is_service: # Standalone executable service
logs_dir = str(exec_dir.joinpath("logs"))

if logs_dir:
# Create path if not exists
if not os.path.exists(logs_dir):
os.makedirs(logs_dir)
Expand Down

0 comments on commit 2483ba8

Please sign in to comment.