microsoft / windows-container-tools

Collection of tools to improve the Windows Containers experience
MIT License
236 stars 66 forks source link

[BUG] LogMonitor requires Path to folder to exist before it is started for file logging. #126

Closed robert-t7k closed 11 months ago

robert-t7k commented 1 year ago

Describe the bug The Log file handler won't work unless the folder to monitor already exists before LogMonitor.exe is started

To Reproduce Steps to reproduce the behavior:

  1. Create a log file configuration for a folder that doesn't exist in the docker image, and that is created by the process started.
  2. Launch the docker image with the Logmonitor starting the process that will create the folder
  3. LogMonitor will log an error like "
    [2023-03-22T14:30:37.000Z][LOGMONITOR] ERROR: Failed to open log directory handle. Directory: \\?\C:\Logs\AppLogs Error=0
    --
  4. If any entry is then written to a file in the c:\logs\applogs\ folder, LogMonitor will not log those errors.


Expected behavior I would expect LogMonitor to recognize that while the folder doesn't exist when it was launched, it might exist in the future, and log based on it being created later. OR Documentation somewhere in the LogMonitor git repo that explicitly outlines this as a hard dependency ("The path to the log files must exist before LogMonitor is started, or it won't be monitored")

Screenshots If applicable, add screenshots to help explain your problem.

Configuration -Tool: LogMonitor -Version: 1.2

Additional context Add any other context about the problem here.