I have some scripts where I'd like to separate their log output from the standard Sitecore Powershell log (SPE.log).

Is there a parameter which I can use on Write-Log to output to a named log file?

up vote 5 down vote accepted

You cannot. It doesn't support anything like that.

Here is a documentation of Write-Log cmldet.

If you are interested you can see how it is implemented:

SPE jsut defines it own log4net appender, see configuration here Cognifide.PowerShell.config (serach for PowerShellExtensionsFileAppender)

You would have to implement your own solution with dynamic appenders.

This might give you an idea of where to start: How to add log4net appender in runtime?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.