Skip to content

Commit

Permalink
bin/bookkeeper doesn't output the result to the console (apache#2155)
Browse files Browse the repository at this point in the history
### Motivation

the change from log4j to log4j2 in 2.0 changes the logging behavior for `bin/bookkeeper`. some of the results of BookieShell is not showed up in Console, and other loggings (e.g. zookeeper) are showed up.

### Modifications

- add a logger for `BookieShell` and set its log level to INFO and appender to Console.
- make other loggers parameterized. and turn them off in `bin/bookkeeper`

### Result

This achieves the same behavior as in 1.2x releases.
  • Loading branch information
sijie authored Jul 14, 2018
1 parent 35a121b commit 54dcee4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
6 changes: 4 additions & 2 deletions bin/bookkeeper
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ BOOKIE_LOG_FILE=${BOOKIE_LOG_FILE:-"bookkeeper-server.log"}

#Configure log configuration system properties
OPTS="$OPTS -Dpulsar.log.appender=$BOOKIE_LOG_APPENDER"
OPTS="$OPTS -Dbookkeeper.log.dir=$BOOKIE_LOG_DIR"
OPTS="$OPTS -Dbookkeeper.log.file=$BOOKIE_LOG_FILE"
OPTS="$OPTS -Dbk.log.appender=$BOOKIE_LOG_APPENDER"
OPTS="$OPTS -Dbk.log.level=error"
OPTS="$OPTS -Dpulsar.log.dir=$BOOKIE_LOG_DIR"
OPTS="$OPTS -Dpulsar.log.file=$BOOKIE_LOG_FILE"

#Change to BK_HOME to support relative paths
cd "$BK_HOME"
Expand Down
24 changes: 22 additions & 2 deletions conf/log4j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Configuration:
value: "Console"
- name: "bk.log.level"
value: "info"
- name: "bk.log.appender"
value: "BkRollingFile"

# Example: logger-filter script
Scripts:
Expand Down Expand Up @@ -165,17 +167,35 @@ Configuration:
level: "${sys:pulsar.log.level}"

Logger:
- name: org.apache.bookkeeper.bookie.BookieShell
level: info
additivity: false
AppenderRef:
- ref: Console

- name: org.apache.bookkeeper
level: "${sys:bk.log.level}"
additivity: false
AppenderRef:
- ref: BkRollingFile
- ref: "${sys:bk.log.appender}"

- name: org.apache.distributedlog
level: "${sys:bk.log.level}"
additivity: false
AppenderRef:
- ref: BkRollingFile
- ref: "${sys:bk.log.appender}"

- name: org.apache.zookeeper
level: "${sys:bk.log.level}"
additivity: false
AppenderRef:
- ref: "${sys:bk.log.appender}"

- name: verbose
level: info
additivity: false
AppenderRef:
- ref: Console

# Logger to inject filter script
# - name: org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl
Expand Down

0 comments on commit 54dcee4

Please sign in to comment.