You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,8 @@
18
18
## bootlogger
19
19
bootlogger is a command-line tool for Windows that logs system restart events, commonly known as a [reboot](https://en.wikipedia.org/wiki/Reboot). It records the date and time of each reboot, along with the computer name, and optionally the Windows version and build info. The log file name and location can be specified and the boot time can be formatted in any of more than a dozen date/time formats. bootlogger can also add itself to the Windows registry to run automatically at startup, ensuring that all reboots are logged. BTW, the name is "bootlogger", all lowercase.
20
20
21
-
## Why bootlogger?
22
-
Perhaps you've seen my [Windows Update Viewer](https://github.com/Timthreetwelve/WUView) app or maybe [Get My IP](https://github.com/Timthreetwelve/GetMyIP) or one of the others. I needed to take a short break from maintaining those and felt like trying something new. I'd read good things about the [Go language](https://go.dev) and decided to give it a go _(pun intended)_. I was using a PowerShell script to log reboots, so I decided that rewriting it in Go would be a good project. The result is what you see here. I found it easy to get started with Go. Easier than writing this README file!
21
+
## Why bootlogger and Why Go?
22
+
Perhaps you've seen my [Windows Update Viewer](https://github.com/Timthreetwelve/WUView) app or maybe [Get My IP](https://github.com/Timthreetwelve/GetMyIP) or one of the others. I needed to take a short break from maintaining those and felt like trying something new. I'd read good things about the [Go language](https://go.dev) and decided to give it a go _(pun intended)_. I was using a PowerShell script to log reboots, so I decided that rewriting it in Go would be a good first project. The result is what you see here. I found it easy to get started with Go. The [Cobra](https://github.com/spf13/cobra) and [Viper](https://github.com/spf13/cobra) packages made things a lot easier
23
23
24
24
## What it logs
25
25
#### Computer name
@@ -38,7 +38,7 @@ The build number comes from combining the `CurrentBuildNumber` value with the `U
38
38
The computer name, reboot date and time, and the Windows version and build are written as a single record to the log file. As noted above, the logging of the version and build info is optional. That is controlled by the `no-buildinfo` option discussed below.
39
39
40
40
## Usage
41
-
Running bootlogger without any additional commands or flags will write a record to the log file using the default configuration or the updated configuration found in environment variables, a configuration file, and/or command-line flags.
41
+
Running bootlogger without any additional commands or flags will write a record to the log file using the default configuration or the updated configuration found in environment variables, a configuration file, and/or command-line flags._Continue reading for examples_.
42
42
43
43
## Commands
44
44
Before discussing configuration, a few words about commands. Commands can be differentiated from flags by the fact that they don't begin with the dash, or two dashes, that flags use.
@@ -58,10 +58,10 @@ or check its current status. When enabled, bootlogger will be added to the Windo
58
58
Use `bootlogger.exe [command] --help` for more information about any of these commands.
59
59
60
60
#### Example command output:
61
-
```powershell
62
-
bootlog.exe printconfig
61
+
```cmd
62
+
bootlogger.exe printconfig
63
63
bootlogger configuration:
64
-
logfile = ./bootlogger.test.log
64
+
logfile = D:\Logs\bootlogger.test.log
65
65
namewidth = 12
66
66
no-buildinfo = true
67
67
no-text = false
@@ -82,13 +82,13 @@ Configurable options are:
82
82
83
83
|Option|Type|Default value|Description|
84
84
|------|----|-------------|-----------|
85
-
|`dryrun`|Boolean|`false`|Write log line to console but not to the log file.|
86
-
|`logfile`|String|`./bootlog.txt`|Log file filename with path. Use quotes if there are spaces in the path.|
87
-
|`namewidth`|Integer|`14`|Minimum computer name width. Longer names are not truncated. Shorter names are padded with spaces.|
88
-
|`no-buildinfo`|Boolean|`false`|Version and build info will not be included in the log entry.|
89
-
|`no-text`|Boolean|`false`|The descriptive text "was rebooted on" will not be included in the log entry.|
90
-
|`quiet`|Boolean|`false`|Quiet operation. Do not print non-error messages to the console.|
91
-
|`timeformat`|String|`12Hour`|Date/Time format. Use `12Hour` for 12 hour, `24Hour` for 24 hour or most of the Go pre-defined formats. _DateOnly and TimeOnly are not included_. See https://pkg.go.dev/time#pkg-constants for details. |
85
+
|`dryrun`|Boolean|`false`|Write log line to console but _**not**_ to the log file. Useful for testing.|
86
+
|`logfile`|String|`bootlog.txt`|Log file filename with fully qualified ([absolute](https://www.computerhope.com/issues/ch001708.htm)) path. Use quotes if there are spaces in the path.|
87
+
|`namewidth`|Integer|`14`|Minimum computer name width. Longer names are _**not**_ truncated. Shorter names are padded with spaces.|
88
+
|`no-buildinfo`|Boolean|`false`|Version and build info will_**not**_ be included in the log entry.|
89
+
|`no-text`|Boolean|`false`|The "was rebooted on" text will _**not**_ be included in the log entry.|
90
+
|`quiet`|Boolean|`false`|Quiet operation. Do _**not**_ print non-error messages to the console.|
91
+
|`timeformat`|String|`12Hour`|Date/Time format. Use `12Hour` for 12 hour, `24Hour` for 24 hour or most of the Go pre-defined formats. _DateOnly and TimeOnly are _**not**_ included_. See https://pkg.go.dev/time#pkg-constants for details. |
92
92
93
93
94
94
### Configuration file
@@ -97,7 +97,7 @@ If used, the configuration file _**must**_ be named `config.yaml` and _**must**_
97
97
#### Example configuration file:
98
98
```yaml
99
99
# Name of the log file
100
-
LogFile: "./bootlogger.log"
100
+
LogFile: "D:\Logs\bootlogger.test.log"
101
101
102
102
# Minimum width of the computer name field in the log
103
103
NameWidth: 12
@@ -137,19 +137,19 @@ Note that shorthand flags must be **lower case**.
137
137
138
138
#### Command-line examples:
139
139
```powershell
140
-
bootlog.exe --timeformat 12hour
140
+
bootlogger.exe --timeformat 12hour
141
141
Desktop-Computer was rebooted on 2025-06-19 7:43:19 AM [Windows 11 Pro build 26100.4061]
142
142
143
-
bootlog.exe -t=24h
143
+
bootlogger.exe -t=24h
144
144
Desktop-Computer was rebooted on 2025-06-19 07:43:19 [Windows 11 Pro build 26100.4061]
145
145
146
-
bootlog.exe --timeformat RFC822 --no-buildinfo
146
+
bootlogger.exe --timeformat RFC822 --no-buildinfo
147
147
Desktop-Computer was rebooted on 19 Jun 25 07:43 CDT
148
148
149
-
bootlog.exe --no-text
149
+
bootlogger.exe --no-text
150
150
Desktop-Computer 2025-06-19 7:43:19 AM [Windows 11 Pro build 26100.4061]
151
151
152
-
bootlog.exe --logfile d:\logs\bootlog.txt -q
152
+
bootlogger.exe --logfile d:\logs\bootlog.txt -q
153
153
#The entry will be made in the log file but nothing will be written to the console.
0 commit comments