在Storm Bolt中启动的Spring boot禁用对工作日志的记录
我已经将spring boot添加到我的bolt中,除了在集群上运行SpringApplication.run时日志记录丢失之外,其他一切都正常工作。我看不到storm的工作日志目录中的日志。奇怪的是,这在localmode下可以正常工作(我可以在console.out中看到),但在部署到storm集群时不起作用在Storm Bolt中启动的Spring boot禁用对工作日志的记录,spring,spring-boot,logback,apache-storm,Spring,Spring Boot,Logback,Apache Storm,我已经将spring boot添加到我的bolt中,除了在集群上运行SpringApplication.run时日志记录丢失之外,其他一切都正常工作。我看不到storm的工作日志目录中的日志。奇怪的是,这在localmode下可以正常工作(我可以在console.out中看到),但在部署到storm集群时不起作用 public class TestBolt extends BaseBasicBolt { private static final Logger LOGGER = LoggerFac
public class TestBolt extends BaseBasicBolt {
private static final Logger LOGGER = LoggerFactory.getLogger(TestBolt.class);
private static final long serialVersionUID = 1L;
@SpringBootApplication
@Configuration
@ComponentScan(basePackages="com.test")
static class SpringApplication1 {
@Autowired
static TestService testServiceInstance;
public static void main(String[] args){
testServiceInstance.logthis("I CANT SEE THIS");
LOGGER.info("I CANT SEE THIS ASWELL");
}
}
@Component
static class TestService{
public String logThis(String t){
LOGGER.info(t);
return t;
}
}
@Override
public void execute(Tuple tuple, BasicOutputCollector collector) {
LOGGER.info(" I CAN SEE THIS");
SpringApplication.run(TestBolt.SpringApplication1.class, new String[]{});
}
}集群中每个节点上的记录器配置是否与本地计算机上的相同?我不这么认为。我相信它在本地使用的是uberjar的resources文件夹中的log4j.properties。我相信在cluster storm上使用的是cluster.xml?我使用的是Hortonworks发行版2.2.1我不熟悉Hortonworks发行版。但是我会假设日志去了其他地方,或者日志被禁用了,或者其他什么。。。你应该试着弄清楚Hortonworks是如何配置Storm的(或者试着根据你的需要定制配置);将正确记录。弹簧打开的那一刻,所有的伐木都消失了。日志不会在任何地方写入。就好像spring启用了自己的日志系统一样。