Commit 1e8d499c authored by Jason Yellick's avatar Jason Yellick Committed by Gerrit Code Review
Browse files

Merge "Make logging for solo orderer configurable" into feature/convergence

parents 3d5deb26 a9c7034e
......@@ -50,6 +50,14 @@ func main() {
}
func launchSolo(conf *config.TopLevel) {
var loglevel string
flag.StringVar(&loglevel, "loglevel", "info",
"Set the logging level for the orderer. (Suggested values: info, debug)")
flag.Parse()
solo.SetLogLevel(loglevel)
config.SetLogLevel(loglevel)
grpcServer := grpc.NewServer()
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", conf.General.ListenAddress, conf.General.ListenPort))
......@@ -84,9 +92,6 @@ func launchSolo(conf *config.TopLevel) {
}
func launchKafka(conf *config.TopLevel) {
var kafkaVersion = sarama.V0_9_0_1 // TODO Ideally we'd set this in the YAML file but its type makes this impossible
conf.Kafka.Version = kafkaVersion
var loglevel string
var verbose bool
......@@ -102,6 +107,9 @@ func launchKafka(conf *config.TopLevel) {
sarama.Logger = log.New(os.Stdout, "[sarama] ", log.Lshortfile)
}
var kafkaVersion = sarama.V0_9_0_1 // TODO Ideally we'd set this in the YAML file but its type makes this impossible
conf.Kafka.Version = kafkaVersion
ordererSrv := kafka.New(conf)
defer ordererSrv.Teardown()
......
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package solo
import (
"os"
"strings"
logging "github.com/op/go-logging"
)
var logger *logging.Logger
func init() {
backend := logging.NewLogBackend(os.Stderr, "", 0)
logging.SetBackend(backend)
formatter := logging.MustStringFormatter("[%{time:15:04:05}] %{shortfile:18s}: %{color}[%{level:-5s}]%{color:reset} %{message}")
logging.SetFormatter(formatter)
logger = logging.MustGetLogger("orderer/solo")
logging.SetLevel(logging.INFO, "") // Silence debug-level outputs when testing
}
// SetLogLevel sets the package logging level
func SetLogLevel(level string) {
logLevel, _ := logging.LogLevel(strings.ToUpper(level)) // TODO Validate input
logging.SetLevel(logLevel, logger.Module)
}
......@@ -22,16 +22,9 @@ import (
ab "github.com/hyperledger/fabric/orderer/atomicbroadcast"
"github.com/hyperledger/fabric/orderer/rawledger"
"github.com/op/go-logging"
"google.golang.org/grpc"
)
var logger = logging.MustGetLogger("orderer/solo")
func init() {
logging.SetLevel(logging.DEBUG, "")
}
type server struct {
bs *broadcastServer
ds *deliverServer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment