gulecroc opened a new issue, #4624:
URL: https://github.com/apache/bookkeeper/issues/4624

   **QUESTION**
   
   Hello,
   
   I'd like to change the format of the data returned by the CLI, particularly 
the Bookkeeper Shell. 
   
   Currently, everything goes through the logs. 
   
   Would it be possible to define a more usable format like the API with JSON 
output ?
   
   Exemple :
   
   * currently :
     * log4j2-bkcli.xml :
     ```xml
     <Configuration status="warn" monitorInterval="10">
         <Properties>
             <Property name="bookkeeper.cli.log.root.level">ERROR</Property>
             <Property 
name="bookkeeper.cli.log.root.appender">CONSOLE</Property>
         </Properties>
         <Appenders>
             <Console name="CONSOLE" target="SYSTEM_OUT">
                 <PatternLayout pattern="%m%n"/>
             </Console>
         </Appenders>
         <Loggers>
             <Root level="${sys:bookkeeper.cli.log.root.level}">
                 <AppenderRef ref="${sys:bookkeeper.cli.log.root.appender}"/>
             </Root>
             <Logger name="org.apache.bookkeeper.bookie.BookieShell" 
level="INFO">
                 <AppenderRef ref="CONSOLE"/>
             </Logger>
             <Logger name="org.apache.bookkeeper.tools.cli" level="INFO">
                 <AppenderRef ref="CONSOLE"/>
             </Logger>
         </Loggers>
     </Configuration>
      ```
     * command : 
     ```
     $ BOOKIE_LOG_CONF=conf/log4j2-bkcli.xml bin/bookkeeper shell listbookies -a
     ```
     * result :
     ```
     All Bookies :
     
BookieID:eda-pulsar-helm-chart-bookie-1.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local:3181,
 IP:10.125.32.9, Port:3181, 
Hostname:eda-pulsar-helm-chart-bookie-1.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local
     
BookieID:eda-pulsar-helm-chart-bookie-0.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local:3181,
 IP:10.125.33.90, Port:3181, 
Hostname:eda-pulsar-helm-chart-bookie-0.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local
     
BookieID:eda-pulsar-helm-chart-bookie-2.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local:3181,
 IP:10.125.34.20, Port:3181, 
Hostname:eda-pulsar-helm-chart-bookie-2.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local
     ```
   
   * with output format :
     * command :
     ```
     $ BOOKIE_LOG_CONF=conf/log4j2-bkcli.xml bin/bookkeeper shell listbookies 
-a --output json
     ```
     * result :
     ```json
     {
     
"eda-pulsar-helm-chart-bookie-1.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local:3181"
 : null,
     
"eda-pulsar-helm-chart-bookie-0.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local:3181"
 : null,
     
"eda-pulsar-helm-chart-bookie-2.eda-pulsar-helm-chart-bookie.n-eda-d.svc.cluster.local:3181"
 : null
     }
     ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to