Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syslog does not add the priority #3675

Closed
gopherbot opened this issue May 28, 2012 · 2 comments
Closed

syslog does not add the priority #3675

gopherbot opened this issue May 28, 2012 · 2 comments

Comments

@gopherbot
Copy link
Contributor

by raul.san@sent.com:

// go run test.go
package main

import (
        "fmt"
        "log/syslog"
)

func main() {
        slog, err := syslog.New(syslog.LOG_ERR, "[foo]")
        if err != nil {
                fmt.Printf("%s", err)
        }

        slog.Alert("alert msg")
        slog.Crit("crit msg")
        slog.Debug("debug msg")
        slog.Emerg("emerg msg")
        slog.Err("err msg")
        slog.Info("info msg")
        slog.Notice("notice msg")
        slog.Warning("warning msg")
        slog.Write([]byte("msg using write()"))

        slog.Close()
}

// * * *

# tail /var/log/syslog
May 27 19:37:11 fenix [foo]: alert msg
May 27 19:37:11 fenix [foo]: crit msg
May 27 19:37:11 fenix [foo]: debug msg
May 27 19:37:11 fenix [foo]: emerg msg
May 27 19:37:11 fenix [foo]: err msg
May 27 19:37:11 fenix [foo]: info msg
May 27 19:37:11 fenix [foo]: notice msg
May 27 19:37:11 fenix [foo]: warning msg
May 27 19:37:11 fenix [foo]: msg using write()
// * * *

I was expecting that were added the text related to the priority, i.e.:

May 27 19:37:11 fenix [foo]: INFO: info
@bradfitz
Copy link
Contributor

Comment 1:

The syslog client code looks correct.
I think you just need to configure your syslog daemon to log in the way you'd like it to
log.  Perhaps your different systems have different default configurations and you're
used to a specific style.

Status changed to WorkingAsIntended.

@rsc
Copy link
Contributor

rsc commented May 29, 2012

Comment 2:

To clarify what Brad said, the level does not conventionally appear in
the message text. It is used for routing the message to the
appropriate log file. You are looking at the log file that contains
all messages regardless of level.
Russ

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants