老师这个在类里面是如何写的 logger

来源:4-3 应用 log4j 调试动态 SQL

丶子非鱼

2017-06-19 11:04

如何实现的在MessageDao类里面

写回答 关注

1回答

  • 丶子非鱼
    2017-06-19 11:10:27

    我的可以实现但是提示logger这个对象空指针    这个Logger对象如何实例化

    2017-06-19 10:50:13,034[http-bio-8080-exec-3]DEBUG [Message.selectbycommand]-==>  Preparing: SELECT ID,COMMAND,DESCRIPTION,CONTENT FROM message where 1=1 
    2017-06-19 10:50:13,036[http-bio-8080-exec-3]DEBUG [Message.selectbycommand]-==> Parameters: 
    2017-06-19 10:50:13,043[http-bio-8080-exec-3]DEBUG [Message.selectbycommand]-<==      Total: 6
    六月 19, 2017 10:50:13 上午 org.apache.catalina.core.StandardWrapperValve invoke
    严重: Servlet.service() for servlet [ListServlet] in context with path [/Mybatis] threw exception
    java.lang.NullPointerException
    	at Com.DAO.Service.selectbycommand(Service.java:40)
    	at Com.Servlet.ListServlet.doGet(ListServlet.java:34)
    	at Com.Servlet.ListServlet.doPost(ListServlet.java:49)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)


通过自动回复机器人学Mybatis---基础版

微信公众号自动回复功能学习Mybatis,基础教程加案例实战方式学习

107410 学习 · 786 问题

查看课程

相似问题