Author | Friedrich Weinmann (@FredWeinmann) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Get-DbatoolsLog on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbatoolsLog.
Returns log entries for dbatools
Returns log entries for dbatools. Handy when debugging or developing a script using it.
Get-DbatoolsLog
[[-FunctionName] <String>]
[[-ModuleName] <String>]
[[-Target] <Object>]
[[-Tag] <String[]>]
[[-Last] <Int32>]
[-LastError]
[[-Skip] <Int32>]
[[-Runspace] <Guid>]
[[-Level] {Critical | Important | Output | Significant | VeryVerbose | Verbose | SomewhatVerbose | System | Debug | InternalComment | Warning}]
[-Raw]
[-Errors]
[<CommonParameters>]
PS C:\> Get-DbatoolsLog
Returns all log entries currently in memory.
PS C:\> Get-DbatoolsLog -LastError
Returns the last log entry type of error.
PS C:\> Get-DbatoolsLog -Target "a" -Last 1 -Skip 1
Returns all log entries that targeted the object "a" in the second last execution sent.
PS C:\> Get-DbatoolsLog -Tag "fail" -Last 5
Returns all log entries within the last 5 executions that contained the tag "fail"
Default: "*"
Only messages written by similar functions will be returned.
Alias | |
Required | False |
Pipeline | false |
Default Value | * |
Default: "*"
Only messages written by commands from similar modules will be returned.
Alias | |
Required | False |
Pipeline | false |
Default Value | * |
Only messages handling the specified target will be returned.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Only messages containing one of these tags will be returned.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Only messages written by the last X executions will be returned.
Uses Get-History to determine execution. Ignores Get-message commands.
By default, this will also include messages from other runspaces. If your command executes in parallel, that's useful.
If it doesn't and you were offloading executions to other runspaces, consider also filtering by runspace using '-Runspace'
Alias | |
Required | False |
Pipeline | false |
Default Value | 0 |
Only retrieves the last error message type written.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
How many executions to skip when specifying '-Last'.
Has no effect without the '-Last' parameter.
Alias | |
Required | False |
Pipeline | false |
Default Value | 0 |
The guid of the runspace to return messages from.
By default, messages from all runspaces are returned.
Run the following line to see the list of guids:
Get-Runspace | ft Id, Name, InstanceId -AutoSize
Alias | |
Required | False |
Pipeline | false |
Default Value |
Limit the message selection by level.
Message levels have a numeric value, making it easier to select a range:
-Level (1..6)
Will select the first 6 levels (Critical - SomewhatVerbose).
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, messages such as SQL statements are flattened. Use raw to see the output without flattened formatting.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Instead of log entries, the error entries will be retrieved
Alias | |
Required | False |
Pipeline | false |
Default Value | False |