log4j的问题
来源:8-10 购物流程之课程页面case设计实战

qq_奇帅_0
2020-05-08
老师,我在case层写了logger.debug(“你的定位方式是:”+ localterBy );这样类似的打印log日志的信息,运行完case后,查看log4j日志,日志中没有我想要的元素,log4j文件内容如下:
2020-05-08 20:49:41 - [ DEBUG ] com.eastmoney.daqi2.logincase.login_case.Init(login_case.java:40) main com.eastmoney.daqi2.logincase.login_case 初始化浏览器
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:122) Forwarding newSession on session null to remote org.apache.http.client.protocol.RequestAddCookies CookieSpec selected: default
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.client.protocol.RequestAuthCache.process(RequestAuthCache.java:76) Forwarding newSession on session null to remote org.apache.http.client.protocol.RequestAuthCache Auth cache not set in the context
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.requestConnection(PoolingHttpClientConnectionManager.java:249) Forwarding newSession on session null to remote org.apache.http.impl.conn.PoolingHttpClientConnectionManager Connection request: [route: {}->http://localhost:29372][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:282) Forwarding newSession on session null to remote org.apache.http.impl.conn.PoolingHttpClientConnectionManager Connection leased: [id: 0][route: {}->http://localhost:29372][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:234) Forwarding newSession on session null to remote org.apache.http.impl.execchain.MainClientExec Opening connection {}->http://localhost:29372
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:131) Forwarding newSession on session null to remote org.apache.http.impl.conn.DefaultHttpClientConnectionOperator Connecting to localhost/127.0.0.1:29372
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:138) Forwarding newSession on session null to remote org.apache.http.impl.conn.DefaultHttpClientConnectionOperator Connection established 127.0.0.1:49649<->127.0.0.1:29372
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:255) Forwarding newSession on session null to remote org.apache.http.impl.execchain.MainClientExec Executing request POST /session HTTP/1.1
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:260) Forwarding newSession on session null to remote org.apache.http.impl.execchain.MainClientExec Target auth state: UNCHALLENGED
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:266) Forwarding newSession on session null to remote org.apache.http.impl.execchain.MainClientExec Proxy auth state: UNCHALLENGED
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onRequestSubmitted(LoggingManagedHttpClientConnection.java:124) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 >> POST /session HTTP/1.1
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onRequestSubmitted(LoggingManagedHttpClientConnection.java:127) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 >> Content-Type: application/json; charset=utf-8
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onRequestSubmitted(LoggingManagedHttpClientConnection.java:127) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 >> Content-Length: 122
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onRequestSubmitted(LoggingManagedHttpClientConnection.java:127) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 >> Host: localhost:29372
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onRequestSubmitted(LoggingManagedHttpClientConnection.java:127) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 >> Connection: Keep-Alive
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onRequestSubmitted(LoggingManagedHttpClientConnection.java:127) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 >> User-Agent: Apache-HttpClient/4.4.1 (Java/1.8.0_131)
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onRequestSubmitted(LoggingManagedHttpClientConnection.java:127) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 >> Accept-Encoding: gzip,deflate
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "POST /session HTTP/1.1[\r][\n]"
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "Content-Type: application/json; charset=utf-8[\r][\n]"
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "Content-Length: 122[\r][\n]"
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "Host: localhost:29372[\r][\n]"
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.4.1 (Java/1.8.0_131)[\r][\n]"
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> "[\r][\n]“
2020-05-08 20:49:44 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:86) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 >> “{“desiredCapabilities”:{“browserName”:“chrome”,“chromeOptions”:{“args”:[],“extensions”:[]},“version”:””,“platform”:“ANY”}}"
2020-05-08 20:49:48 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
2020-05-08 20:49:48 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 << "Content-Length:1040[\r][\n]"
2020-05-08 20:49:48 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 << "Content-Type:application/json; charset=utf-8[\r][\n]"
2020-05-08 20:49:48 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:72) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 << "[\r][\n]"
2020-05-08 20:49:48 - [ DEBUG ] org.apache.http.impl.conn.Wire.wire(Wire.java:86) Forwarding newSession on session null to remote org.apache.http.wire http-outgoing-0 << "{“sessionId”:“0e5b82881bc262e1bd6947f754c64a67”,“status”:0,“value”:{“acceptInsecureCerts”:false,“acceptSslCerts”:false,“applicationCacheEnabled”:false,“browserConnectionEnabled”:false,“browserName”:“chrome”,“chrome”:{“chromedriverVersion”:“77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865@{#442})”,“userDataDir”:“C:\Users\Administrator\AppData\Local\Temp\scoped_dir6604_953739661”},“cssSelectorsEnabled”:true,“databaseEnabled”:false,“goog:chromeOptions”:{“debuggerAddress”:“localhost:49653”},“handlesAlerts”:true,“hasTouchScreen”:false,“javascriptEnabled”:true,“locationContextEnabled”:true,“mobileEmulationEnabled”:false,“nativeEvents”:true,“networkConnectionEnabled”:false,“pageLoadStrategy”:“normal”,“platform”:“Windows NT”,“proxy”:{},“rotatable”:false,“setWindowRect”:true,“strictFileInteractability”:false,“takesHeapSnapshot”:true,“takesScreenshot”:true,“timeouts”:{“implicit”:0,“pageLoad”:300000,“script”:30000},“unexpectedAlertBehaviour”:“ignore”,“version”:“77.0.3865.90”,“webStorageEnabled”:true}}"
2020-05-08 20:49:48 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onResponseReceived(LoggingManagedHttpClientConnection.java:113) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 << HTTP/1.1 200 OK
2020-05-08 20:49:48 - [ DEBUG ] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.onResponseReceived(LoggingManagedHttpClientConnection.java:116) Forwarding newSession on session null to remote org.apache.http.headers http-outgoing-0 << Content-Length:1040
太多了,我就不截取了,打印的这个日志内容,有点看不懂,请老师帮指导我一下,我到底错在哪了?
1回答
-
Mushishi
2020-05-09
logger.debug 这个log配置文件中你配置了把debug模式得文件输出到console里面了吗
172020-05-12
相似问题