linuxgovmwarehashicorp-vaultphoton-os

Logging Methods on Photon OS linux -my app log file is not created on the specified location by the application


I have small application written in golang and i have mentioned a path to create a log file in order to track the application flow. but as soon as app started the log files created on both of my ubuntu fedora version, but log does not created on photon OS vm ware , and there is no error also showing.

this is my code and it working fine , put just for reference.

f, err := os.OpenFile("/var/log/pluginlog.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
    return err
    logical.ErrorResponse("Error:creating log file " + err.Error())
    fmt.Sprintf("error", err)
}
defer f.Close()
loggr := log.New(f, "prefix", log.LstdFlags)
loggr.Println(logv)
return err

and i have gone thru some of the docs available for photon os and it says

On Photon OS, all the system logs except the installation logs and the cloud-init logs are written into the systemd journal. The journalctl command queries the contents of the systemd journal.

which means does my log also put an entry to the journal ?

but if that the case how can i access that specific log ?

(the app is a plugin developed for hashicorp-vault and plugin runs with the vault environment.) any body have any idea if please help me? thanks in advance.


Solution

  • figured out the issue. actually the code wasn't throwing an error. actually i had a error on permission while accessing the log path. and understood that we can create separate log file on photon os linux version as well , other than writing to journal.