Improved log messages

This commit is contained in:
Alvaro Saurin committed 2015-04-09 16:19:05 +02:00
1 parent 5d5b101707
commit 7811e2b470
3 files changed
+6 -4

No files matched your search

+3
View File
@@ -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 {
var prevValidUntil time.Time
if e.Status == stResolved {
if reply != nil {
Debug.Printf("[cache msgid %d] replacing response in cache", reply.MsgHdr.Id)
}
prevValidUntil = e.validUntil
}
+2 -4
View File
@@ -18,7 +18,6 @@ const (
DefaultCacheLen = 8192 // default cache capacity
DefaultResolvWorkers = 8 // default number of resolution workers
DefaultTimeout = 5 // default timeout for DNS resolutions
DefaultResolvTries = 3 // max # of times a worker tries to resolve a query
)
type DNSServerConfig struct {
@@ -264,7 +263,7 @@ func (s *DNSServer) queryHandler(proto dnsProtocol) dns.HandlerFunc {
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)
s.cache.Put(r, nil, negLocalTTL, CacheNoLocalReplies, now)
w.WriteMsg(makeDNSFailResponse(r))
@@ -360,8 +359,7 @@ func (s *DNSServer) notUsHandler(proto dnsProtocol) dns.HandlerFunc {
w.WriteMsg(reply)
return
}
Warning.Printf("[dns msgid %d] Failed lookup for external name %s",
r.MsgHdr.Id, q.Name)
Warning.Printf("[dns msgid %d] Failed lookup for external name %s", r.MsgHdr.Id, q.Name)
w.WriteMsg(makeDNSFailResponse(r))
}
}
+1
View File
@@ -54,6 +54,7 @@ func main() {
}
InitDefaultLogging(debug)
Info.Printf("WeaveDNS version %s\n", version) // first thing in log: the version
var zone = new(weavedns.ZoneDb)