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

Improve acme logs. #5139

Merged
merged 1 commit into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/provider/acme/challenge_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (p *Provider) Append(router *mux.Router) {
Handler(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)

ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme"))
ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme"))
logger := log.FromContext(ctx)

if token, ok := vars["token"]; ok {
Expand Down
13 changes: 6 additions & 7 deletions pkg/provider/acme/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ func (p *Provider) ListenConfiguration(config dynamic.Configuration) {

// Init for compatibility reason the BaseProvider implements an empty Init
func (p *Provider) Init() error {

ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme"))
ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme"))
logger := log.FromContext(ctx)

if len(p.Configuration.Storage) == 0 {
Expand Down Expand Up @@ -167,7 +166,7 @@ func isAccountMatchingCaServer(ctx context.Context, accountURI string, serverURI
// Provide allows the file provider to provide configurations to traefik
// using the given Configuration channel.
func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error {
ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme."+p.ResolverName))
ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme"))

p.pool = pool

Expand Down Expand Up @@ -199,7 +198,7 @@ func (p *Provider) getClient() (*lego.Client, error) {
p.clientMutex.Lock()
defer p.clientMutex.Unlock()

ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme"))
ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme"))
logger := log.FromContext(ctx)

if p.client != nil {
Expand Down Expand Up @@ -371,7 +370,7 @@ func (p *Provider) watchNewDomains(ctx context.Context) {
domain := domains[i]
safe.Go(func() {
if _, err := p.resolveCertificate(ctx, domain, tlsStore); err != nil {
log.WithoutContext().WithField(log.ProviderName, "acme."+p.ResolverName).
log.WithoutContext().WithField(log.ProviderName, p.ResolverName+".acme").
Errorf("Unable to obtain ACME certificate for domains %q : %v", strings.Join(domain.ToStrArray(), ","), err)
}
})
Expand Down Expand Up @@ -400,7 +399,7 @@ func (p *Provider) watchNewDomains(ctx context.Context) {
domain := domains[i]
safe.Go(func() {
if _, err := p.resolveCertificate(ctx, domain, tlsStore); err != nil {
log.WithoutContext().WithField(log.ProviderName, "acme."+p.ResolverName).
log.WithoutContext().WithField(log.ProviderName, p.ResolverName+".acme").
Errorf("Unable to obtain ACME certificate for domains %q : %v", strings.Join(domain.ToStrArray(), ","), err)
}
})
Expand Down Expand Up @@ -593,7 +592,7 @@ func (p *Provider) saveCertificates() error {

func (p *Provider) refreshCertificates() {
conf := dynamic.Message{
ProviderName: "acme." + p.ResolverName,
ProviderName: p.ResolverName + ".acme",
Configuration: &dynamic.Configuration{
HTTP: &dynamic.HTTPConfiguration{
Routers: map[string]*dynamic.Router{},
Expand Down