Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Johannes Fritsch
fabric
Commits
1e8d499c
Commit
1e8d499c
authored
Oct 28, 2016
by
Jason Yellick
Committed by
Gerrit Code Review
Oct 28, 2016
Browse files
Merge "Make logging for solo orderer configurable" into feature/convergence
parents
3d5deb26
a9c7034e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
10 deletions
+52
-10
orderer/main.go
orderer/main.go
+11
-3
orderer/solo/log.go
orderer/solo/log.go
+41
-0
orderer/solo/solo.go
orderer/solo/solo.go
+0
-7
No files found.
orderer/main.go
View file @
1e8d499c
...
...
@@ -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
()
...
...
orderer/solo/log.go
0 → 100644
View file @
1e8d499c
/*
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
)
}
orderer/solo/solo.go
View file @
1e8d499c
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment