ironmansoftware / universal-automation

Universal Automation is the PowerShell-first automation platform.
https://ironmansoftware.com/universal-automation/
MIT License
24 stars 4 forks source link

Log File C:\Users\adamr\Desktop\log.txt #137

Closed claudiospizzi closed 4 years ago

claudiospizzi commented 4 years ago

Describe the Issue

In a procmon.exe trace I can see, that the Universal Automation tries to write into the following file: C:\Users\adamr\Desktop\log.txt -> Do you have a hard coded log file anywhere. Because we have no users named adamr. In general, it would be great to define a log file location for UA and UD.

Version Information

claudiospizzi commented 4 years ago

Oh by the way, that's the content of the log file:

2020-03-11 23:47:49.802 +01:00 [WRN] Using an in-memory repository. Keys will not be persisted to storage.
2020-03-11 23:47:49.817 +01:00 [WRN] Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
2020-03-11 23:47:49.849 +01:00 [WRN] No XML encryptor configured. Key "<<SOME GUID>>" may be persisted to storage in unencrypted form.
2020-03-11 23:48:05.271 +01:00 [DBG] Starting sync...
2020-03-11 23:48:05.286 +01:00 [DBG] Git has remote. Starting pull
2020-03-11 23:48:05.443 +01:00 [DBG] Git has remote. Starting push
2020-03-11 23:48:05.818 +01:00 [DBG] No changes.
adamdriscoll commented 4 years ago

@claudiospizzi - Nice catch. Yep. There is a hard coded path in there. I'll get that fixed and make sure you can configure it.

adamdriscoll commented 4 years ago

This has been resolved. The default logging path is now: C:\ProgramData\UniversalAutomation\logs

You'll be able to set the logging path to your own location using the UASettings cmdlets.

$Settings = Get-UASettings
$Settings.LoggingFilePath = "C:\myLogs\logs.txt" 
$Settings.LogLevel = "verbose"
Set-UASettings -Settings $Settings
claudiospizzi commented 4 years ago

Just one question. I'm using an IIS hosted UA, there I start it with Start-UAServer -InProcess. I think this command will never stop until I close the AppPool. Can I somehow set the log level and path? Maybe as parameter on Start-UAServer or alternative by creating a settings object an passing it to the start?

$setting = New-UASetting
Start-UAServer -Setting $setting -InProcess
adamdriscoll commented 4 years ago

Sure. That's a good point. I'll add a\some parameter(s) to Start-UAServer so we can diagnose issues at startup.

adamdriscoll commented 4 years ago

Also note that the logging settings are stored in the UA git repo in .ua/settings.ps1