在storm bolt中启动的spring boot禁止记录到工作日志

oyjwcjzk  于 2021-06-21  发布在  Storm
关注(0)|答案(0)|浏览(524)

我已经在bolt中添加了springboot,除了在集群上运行springapplication.run时日志记录丢失之外,其他一切都正常工作。我看不到storm的工作日志目录中的日志。奇怪的是,这在localmode下工作得很好(我可以在console.out中看到),但在部署到storm集群时却不起作用。

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[]{});
}

}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题