java 怎么用log4j记录异常信息

2025-01-19 19:49:49
推荐回答(1个)
回答1:

try{Stringmyaddress=InetAddress.getLocalHost().getHostAddress().toString();log.debug("myaddress:\r\n"+myaddress);}catch(UnknownHostExceptionex){log.debug("message:",ex);ex.printStackTrace();}实际测试,是会换行的~~~~~