Blog Archives

Creating a logging framework in PowerShell – The Final Part


In the final part we will see how to use the new module that we created in scripts.

Tagged with: , , , ,
Posted in PowerShell

Creating a logging framework in PowerShell – Part 4


In Part-1, we looked at why logging was important, established a set of guidelines or targets that we need to keep in mind while designing the framework and defined few variables that we will be using.
In Part-2, we expanded on the basics created a few more variables and created a function ‘Write-Log’, which as the name suggests writes messages to the log file.
InPart-3, we saw how we can manage the multiple log files that get generated using ‘Switch-LogFile’ function.
In this part we will tie everything up and put all the code into a neat little script module that we can use. But, before we do that we need a way to service more than one script in a given session.

Tagged with: , , , ,
Posted in PowerShell

Creating a logging framework in PowerShell – Part 3


In Part-1, we looked at why logging was important, established a set of guidelines or targets that we need to keep in mind while designing the framework and defined few variables that we will be using.

In Part-2, we expanded on the basics created a few more variables and created a function ‘Write-Log’, which as the name suggests writes messages to the log file.

In this part we will look at managing the logs that we will generate.

Tagged with: , , , ,
Posted in PowerShell

Creating a logging framework in PowerShell – Part 2


In the first part; we looked a little bit at why logging was important, established a rudimentary of set guidelines to help us log the script actions and also started taking first steps in our journey to creating a logging framework. So, onwards we move.

Tagged with: , , , ,
Posted in PowerShell

Creating a logging framework in PowerShell – Part 1


Logging is a very crucial technique and is a great tool for investigating and analysing problems. How much logging you want to do depends on the kind of scripts you write. Exploratory scripting might not require you log everything but, during script development it is going to be useful to have knowledge of what your script is doing and it would be good to know what the hell is wrong is that one particular function that you can’t seem to quite figure out. When you are putting out a production script it may become mandatory to log what the script is doing or at the very least log what actions the script is performing.

Tagged with: , , , ,
Posted in PowerShell