You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/10/19 22:55:42 UTC

[GitHub] [pulsar] ooooo-youwillsee commented on issue #12406: How to debug the code of pulsar broker In IDE ?

ooooo-youwillsee commented on issue #12406:
URL: https://github.com/apache/pulsar/issues/12406#issuecomment-947165179


   ### The Question about starting the program
   
   I  lauch `PulsarStandaloneStarter`  for the first time.  Here is log in console.
   ```
   06:13:49.514 [main] ERROR org.apache.bookkeeper.bookie.Journal - Problems reading from data\standalone\bookkeeper0\current\lastMark (this is okay if it is the first time starting this bookie
   Oct 20, 2021 6:14:02 AM org.glassfish.jersey.internal.Errors logErrors
   WARNING: The following warnings have been detected: WARNING: Return type, java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData>, of method, public java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData> org.apache.pulsar.broker.admin.impl.ClustersBase.getNamespaceIsolationPolicies(java.lang.String) throws java.lang.Exception, is not resolvable to a concrete type.
   
   Oct 20, 2021 6:14:03 AM org.glassfish.jersey.internal.Errors logErrors
   WARNING: The following warnings have been detected: WARNING: Return type, java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData>, of method, public java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData> org.apache.pulsar.broker.admin.impl.ClustersBase.getNamespaceIsolationPolicies(java.lang.String) throws java.lang.Exception, is not resolvable to a concrete type.
   ```
   
   then stoping program, again lauch `PulsarStandaloneStarter`  for the sencond time. Here is log in console.
   ```
   Removing file: Oct 20, 2021 6:08:14 AM	data\standalone\zookeeper\version-2\snapshot.0
   Oct 20, 2021 6:15:08 AM org.glassfish.jersey.internal.Errors logErrors
   WARNING: The following warnings have been detected: WARNING: Return type, java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData>, of method, public java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData> org.apache.pulsar.broker.admin.impl.ClustersBase.getNamespaceIsolationPolicies(java.lang.String) throws java.lang.Exception, is not resolvable to a concrete type.
   
   Oct 20, 2021 6:15:09 AM org.glassfish.jersey.internal.Errors logErrors
   WARNING: The following warnings have been detected: WARNING: Return type, java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData>, of method, public java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData> org.apache.pulsar.broker.admin.impl.ClustersBase.getNamespaceIsolationPolicies(java.lang.String) throws java.lang.Exception, is not resolvable to a concrete type.
   
   06:15:10.684 [pulsar-web-48-12] ERROR org.apache.pulsar.broker.admin.impl.ClustersBase - [null] Failed to create cluster global
   org.apache.pulsar.broker.web.RestException: Cluster already exists
   	at org.apache.pulsar.broker.admin.impl.ClustersBase.createCluster(ClustersBase.java:171) ~[classes/:?]
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291]
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_291]
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_291]
   	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291]
   	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[jersey-server-2.34.jar:?]
   	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124) ~[jersey-server-2.34.jar:?]
   ```
   
   I don't modify any changes in `config/standalone.conf`. Why did this happen ?
   
   ### Another question about add `jvm args`  before starting up `PulsarStandaloneStarter`
   
   There is no `INFO`  log in console when I add  `jvm args` for the following code.
   ```
   -Dpulsar.log.appender=RoutingAppender
   -Dpulsar.log.dir=logs/
   -Dpulsar.log.level=info
   -Dpulsar.log.root.level=info
   -Dpulsar.routing.appender.default=Console
   -Dlog4j2.is.webapp=false
   -Dlog4j.configurationFile=conf/log4j2.yaml
   -Dlog4j.shutdownHookEnabled=false
   ```
   
   but it appers the message that `Unable to locate appender "RoutingAppender" for logger config "root"`.
   The complete log below.
   
   ```
   2021-10-20 06:33:18,400 main ERROR Unable to locate plugin type for Prometheus
   2021-10-20 06:33:18,526 main ERROR Unable to locate plugin for Prometheus
   2021-10-20 06:33:18,535 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.config.AppendersPlugin for element Appenders: java.lang.NullPointerException java.lang.NullPointerException
   	at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
   	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:258)
   	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
   	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1002)
   	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:942)
   	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:552)
   	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:241)
   	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:288)
   	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:622)
   	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:695)
   	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:712)
   	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:267)
   	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
   	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
   	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
   	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:138)
   	at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:45)
   	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
   	at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30)
   	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
   	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
   	at org.apache.pulsar.PulsarStandalone.<clinit>(PulsarStandalone.java:51)
   
   2021-10-20 06:33:18,543 main ERROR Unable to locate appender "RoutingAppender" for logger config "root"
   2021-10-20 06:33:18,544 main ERROR Unable to locate appender "Prometheus" for logger config "root"
   2021-10-20 06:33:18,544 main ERROR Unable to locate appender "Console" for logger config "org.apache.bookkeeper.bookie.BookieShell"
   2021-10-20 06:33:18,544 main ERROR Unable to locate appender "Console" for logger config "verbose"
   Removing file: Oct 20, 2021 6:08:15 AM	data\standalone\zookeeper\version-2\log.1
   Removing file: Oct 20, 2021 6:10:22 AM	data\standalone\zookeeper\version-2\snapshot.6
   Oct 20, 2021 6:33:24 AM org.glassfish.jersey.internal.Errors logErrors
   WARNING: The following warnings have been detected: WARNING: Return type, java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData>, of method, public java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData> org.apache.pulsar.broker.admin.impl.ClustersBase.getNamespaceIsolationPolicies(java.lang.String) throws java.lang.Exception, is not resolvable to a concrete type.
   
   Oct 20, 2021 6:33:25 AM org.glassfish.jersey.internal.Errors logErrors
   WARNING: The following warnings have been detected: WARNING: Return type, java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData>, of method, public java.util.Map<java.lang.String, ? extends org.apache.pulsar.common.policies.data.NamespaceIsolationData> org.apache.pulsar.broker.admin.impl.ClustersBase.getNamespaceIsolationPolicies(java.lang.String) throws java.lang.Exception, is not resolvable to a concrete type.
   ```
   
   Now, my solution is adding `jvm args` for `-Dorg.apache.logging.log4j.level=DEBUG` for this program use the `lo4j` logger.
   
   
   At the end
   
   I really want to know  How you set the development environment  when developing pulsar in idea. 
   
   Actuallly, I already read all codes for `RocketMQ` that anthor `message system`.  it only use the enviroment  variable `ROCKET_HOME` for setting all configuration and it also has `the examples module`  for debuging quickly. 
   
   I hope to reduce the complexity of the devlopment configuation.
   
   
   
   
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org