Write to Windows event log: Difference between revisions

Added Go
(Added Go)
Line 333:
log.Source <- "Sample Application"
log.WriteEntry("Entered something in the Application Eventlog!")</lang>
 
=={{header|Go}}==
This works on Windows 10 with administrative privileges.
<lang go>package main
 
import (
"fmt"
"os/exec"
)
 
func main() {
command := "EventCreate"
args := []string{"/T", "INFORMATION", "/ID", "123", "/L", "APPLICATION",
"/SO", "Go", "/D", "\"Rosetta Code Example\""}
cmd := exec.Command(command, args...)
err := cmd.Run()
if err != nil {
fmt.Println(err)
}
}</lang>
 
=={{header|Java}}==
9,476

edits