Skip to content

Prevent creating empty log files #636

@Zerowalker

Description

@Zerowalker

Not sure which version this started happening, but if you do something like

$paramSetPSFLoggingProvider = @{
    Name          = "logfile"
    FilePath      = "$PSScriptRoot\logs\%Date%.csv"
    LogRotatePath = "$PSScriptRoot\logs\*.csv"
    Enabled       = $true
}
Set-PSFLoggingProvider @paramSetPSFLoggingProvider

This will end up creating a log file even if nothing is ever written.
For cases where it's common that nothing happens for most days, it's a bit annoying to have a ton of log files even though just some actually may contains something.

So if possible it would be nice if the files are only created when something is actually written to it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions