You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/06/21 19:21:33 UTC

[GitHub] rob05c closed pull request #2445: log errors from the TO http server to the error log

rob05c closed pull request #2445: log errors from the TO http server to the error log
URL: https://github.com/apache/trafficcontrol/pull/2445
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/traffic_ops/traffic_ops_golang/crconfig/snapshot.go b/traffic_ops/traffic_ops_golang/crconfig/snapshot.go
index f466bd328..f8780ebab 100644
--- a/traffic_ops/traffic_ops_golang/crconfig/snapshot.go
+++ b/traffic_ops/traffic_ops_golang/crconfig/snapshot.go
@@ -31,7 +31,7 @@ import (
 
 // Snapshot takes the CRConfig JSON-serializable object (which may be generated via crconfig.Make), and writes it to the snapshot table.
 func Snapshot(db *sql.DB, crc *tc.CRConfig) error {
-	log.Errorln("DEBUG calling Snapshot")
+	log.Debugln("calling Snapshot")
 	bts, err := json.Marshal(crc)
 	if err != nil {
 		return errors.New("marshalling JSON: " + err.Error())
@@ -40,7 +40,7 @@ func Snapshot(db *sql.DB, crc *tc.CRConfig) error {
 	if crc.Stats.DateUnixSeconds != nil {
 		date = time.Unix(*crc.Stats.DateUnixSeconds, 0)
 	}
-	log.Errorf("DEBUG calling Snapshot, writing %+v\n", date)
+	log.Debugf("calling Snapshot, writing %+v\n", date)
 	q := `insert into snapshot (cdn, content, last_updated) values ($1, $2, $3) on conflict(cdn) do update set content=$2, last_updated=$3`
 	if _, err := db.Exec(q, crc.Stats.CDNName, bts, date); err != nil {
 		return errors.New("Error inserting the snapshot into database: " + err.Error())
@@ -53,7 +53,7 @@ func Snapshot(db *sql.DB, crc *tc.CRConfig) error {
 // If the CDN exists, but the snapshot does not, the string for an empty JSON object "{}" is returned.
 // An error is only returned on database error, never if the CDN or snapshot does not exist.
 func GetSnapshot(db *sql.DB, cdn string) (string, bool, error) {
-	log.Errorln("DEBUG calling GetSnapshot")
+	log.Debugln("calling GetSnapshot")
 
 	snapshot := sql.NullString{}
 	// cdn left join snapshot, so we get a row with null if the CDN exists but the snapshot doesn't, and no rows if the CDN doesn't exist.
diff --git a/traffic_ops/traffic_ops_golang/traffic_ops_golang.go b/traffic_ops/traffic_ops_golang/traffic_ops_golang.go
index ba341e687..f5e286578 100644
--- a/traffic_ops/traffic_ops_golang/traffic_ops_golang.go
+++ b/traffic_ops/traffic_ops_golang/traffic_ops_golang.go
@@ -131,6 +131,7 @@ func main() {
 		ReadHeaderTimeout: time.Duration(cfg.ReadHeaderTimeout) * time.Second,
 		WriteTimeout:      time.Duration(cfg.WriteTimeout) * time.Second,
 		IdleTimeout:       time.Duration(cfg.IdleTimeout) * time.Second,
+		ErrorLog:          log.Error,
 	}
 
 	if err := server.ListenAndServeTLS(cfg.CertPath, cfg.KeyPath); err != nil {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services