I have a simple if
condition in which I use System.out.println
. I would like to know how can I modify the code in order to replace this usage of a system.out
by a logger ?
if(myVar.getDate().equals(20141127) && myVar.getNumber().equals(1)) {
System.out.println("");
}
Any suggestions ?
Thanks
You can use some logger utility to log the details.
Have a look at Apache Log4j
The logging is as simple as
log.debug("This is an debug message");
where log is an instance of logger
For sample code you can look into this tutorial
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.