Although logging PowerShell activity for security can be implemented by 'Over-the-shoulder transcription' in v5, you may want to add some advanced logging to your scripts, while minimizing log management and keeping it consistent across your environments. Using the log4net library as a base and leveraging it with PowerShell, the log4ps module enables you to implement structured logging for your scripts, driven by XML files, picking up changes on the fly without the need to restart your script. With no more code than you already have, you can send logs to files, with a cap on their size, roll them automatically, use buffers, time stamps, context and so on. But if you really want to push further, by simply editing the XML definition you can log to EventLog, SMTP, Databases, SysLog, TCP Sink, UDP endpoints, ELMAH, Logstash for elastic search, Loggly, AWS or Message Queues directly from your script!
Watch video Advanced Logging with log4net: principle, practice and applications (Gael Colas) online, duration hours minute second in high quality that is uploaded to the channel PowerShell Conference EU 15 May 2016. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 2,023 times and liked it 7 visitors.