I want to output the logs in Flink, I have created the logger code as mentioned below
I have imported the LoggerFactory
import org.slf4j.LoggerFactory;
Class CEPMonitoring contains code as follows
final static org.slf4j.Logger logger = LoggerFactory.getLogger(CEPMonitoring.class);
public static void main(String[] args) throws Exception {
logger.info("execution began \n ");
}
However, this is not printing anything. Also, I don't have logback.xml
file as mentioned at https://ci.apache.org/projects/flink/flink-docs-release-0.7/internal_logging.html
P.S - I am getting error when i use
final static Logger logger = LoggerFactory.getLogger(CEPMonitoring.class);
Which finally led me to write
final static org.slf4j.Logger logger = LoggerFactory.getLogger(CEPMonitoring.class);
it gave an error and then I have to
On top of all this I am getting following warning upon running program
log4j:WARN No appenders could be found for logger (org.stsffap.cep.monitoring.CEPMonitoring).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I am confused what to do?
I was able to see the logs by creating a
log4j.properties
file in thesrc/main/resources
folder and adding following code to itIn order to learn what these properties mean, I will recommend watching https://www.youtube.com/watch?v=-GkRuFU_sUgc
Also in order to suppress below warning
Add the following line