Skip to content

Commit

Permalink
[ROCKETMQ-178] Fix -p -m options closes apache#93
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhanhui authored and dongeforever committed May 26, 2017
1 parent c0fe02e commit 42826c4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
32 changes: 17 additions & 15 deletions broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,6 @@ public static BrokerController createBrokerController(String[] args) {
messageStoreConfig.setAccessMessageInMemoryMaxRatio(ratio);
}

if (commandLine.hasOption('p')) {
MixAll.printObjectProperties(null, brokerConfig);
MixAll.printObjectProperties(null, nettyServerConfig);
MixAll.printObjectProperties(null, nettyClientConfig);
MixAll.printObjectProperties(null, messageStoreConfig);
System.exit(0);
} else if (commandLine.hasOption('m')) {
MixAll.printObjectProperties(null, brokerConfig, true);
MixAll.printObjectProperties(null, nettyServerConfig, true);
MixAll.printObjectProperties(null, nettyClientConfig, true);
MixAll.printObjectProperties(null, messageStoreConfig, true);
System.exit(0);
}

if (commandLine.hasOption('c')) {
String file = commandLine.getOptionValue('c');
if (file != null) {
Expand Down Expand Up @@ -181,8 +167,24 @@ public static BrokerController createBrokerController(String[] args) {
configurator.setContext(lc);
lc.reset();
configurator.doConfigure(brokerConfig.getRocketmqHome() + "/conf/logback_broker.xml");
log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);

if (commandLine.hasOption('p')) {
Logger console = LoggerFactory.getLogger(LoggerName.BROKER_CONSOLE_NAME);
MixAll.printObjectProperties(console, brokerConfig);
MixAll.printObjectProperties(console, nettyServerConfig);
MixAll.printObjectProperties(console, nettyClientConfig);
MixAll.printObjectProperties(console, messageStoreConfig);
System.exit(0);
} else if (commandLine.hasOption('m')) {
Logger console = LoggerFactory.getLogger(LoggerName.BROKER_CONSOLE_NAME);
MixAll.printObjectProperties(console, brokerConfig, true);
MixAll.printObjectProperties(console, nettyServerConfig, true);
MixAll.printObjectProperties(console, nettyClientConfig, true);
MixAll.printObjectProperties(console, messageStoreConfig, true);
System.exit(0);
}

log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);
MixAll.printObjectProperties(log, brokerConfig);
MixAll.printObjectProperties(log, nettyServerConfig);
MixAll.printObjectProperties(log, nettyClientConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class LoggerName {
public static final String FILTERSRV_LOGGER_NAME = "RocketmqFiltersrv";
public static final String NAMESRV_LOGGER_NAME = "RocketmqNamesrv";
public static final String BROKER_LOGGER_NAME = "RocketmqBroker";
public static final String BROKER_CONSOLE_NAME = "RocketmqConsole";
public static final String CLIENT_LOGGER_NAME = "RocketmqClient";
public static final String TOOLS_LOGGER_NAME = "RocketmqTools";
public static final String COMMON_LOGGER_NAME = "RocketmqCommon";
Expand Down
5 changes: 5 additions & 0 deletions distribution/conf/logback_broker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@
<appender-ref ref="RocketmqFilterAppender"/>
</logger>

<logger name="RocketmqConsole" additivity="false">
<level value="INFO" />
<appender-ref ref="STDOUT" />
</logger>

<root>
<level value="INFO"/>
<appender-ref ref="DefaultAppender"/>
Expand Down

0 comments on commit 42826c4

Please sign in to comment.