Improved log messages
This commit is contained in:
1 parent
5d5b101707
commit
7811e2b470
3 files changed
+6
-4
No files matched your search
@@ -131,6 +131,9 @@ func (e cacheEntry) hasExpired(now time.Time) bool {
|
|||||||
func (e *cacheEntry) setReply(reply *dns.Msg, ttl int, flags uint8, now time.Time) bool {
|
func (e *cacheEntry) setReply(reply *dns.Msg, ttl int, flags uint8, now time.Time) bool {
|
||||||
var prevValidUntil time.Time
|
var prevValidUntil time.Time
|
||||||
if e.Status == stResolved {
|
if e.Status == stResolved {
|
||||||
|
if reply != nil {
|
||||||
|
Debug.Printf("[cache msgid %d] replacing response in cache", reply.MsgHdr.Id)
|
||||||
|
}
|
||||||
prevValidUntil = e.validUntil
|
prevValidUntil = e.validUntil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ const (
|
|||||||
DefaultCacheLen = 8192 // default cache capacity
|
DefaultCacheLen = 8192 // default cache capacity
|
||||||
DefaultResolvWorkers = 8 // default number of resolution workers
|
DefaultResolvWorkers = 8 // default number of resolution workers
|
||||||
DefaultTimeout = 5 // default timeout for DNS resolutions
|
DefaultTimeout = 5 // default timeout for DNS resolutions
|
||||||
DefaultResolvTries = 3 // max # of times a worker tries to resolve a query
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DNSServerConfig struct {
|
type DNSServerConfig struct {
|
||||||
@@ -264,7 +263,7 @@ func (s *DNSServer) queryHandler(proto dnsProtocol) dns.HandlerFunc {
|
|||||||
now = time.Now()
|
now = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
Info.Printf("[dns msgid %d] No results for type %s query %s",
|
Info.Printf("[dns msgid %d] No results for type %s query %s [caching no-local]",
|
||||||
r.MsgHdr.Id, dns.TypeToString[q.Qtype], q.Name)
|
r.MsgHdr.Id, dns.TypeToString[q.Qtype], q.Name)
|
||||||
s.cache.Put(r, nil, negLocalTTL, CacheNoLocalReplies, now)
|
s.cache.Put(r, nil, negLocalTTL, CacheNoLocalReplies, now)
|
||||||
w.WriteMsg(makeDNSFailResponse(r))
|
w.WriteMsg(makeDNSFailResponse(r))
|
||||||
@@ -360,8 +359,7 @@ func (s *DNSServer) notUsHandler(proto dnsProtocol) dns.HandlerFunc {
|
|||||||
w.WriteMsg(reply)
|
w.WriteMsg(reply)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Warning.Printf("[dns msgid %d] Failed lookup for external name %s",
|
Warning.Printf("[dns msgid %d] Failed lookup for external name %s", r.MsgHdr.Id, q.Name)
|
||||||
r.MsgHdr.Id, q.Name)
|
|
||||||
w.WriteMsg(makeDNSFailResponse(r))
|
w.WriteMsg(makeDNSFailResponse(r))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,6 +54,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
InitDefaultLogging(debug)
|
InitDefaultLogging(debug)
|
||||||
|
Info.Printf("WeaveDNS version %s\n", version) // first thing in log: the version
|
||||||
|
|
||||||
var zone = new(weavedns.ZoneDb)
|
var zone = new(weavedns.ZoneDb)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user