Я настроил проект с Log4j. Я настроил log4j используя log4.properties
файл.
Во время выполнения теста создается файл myLog.log
, но в файл журнала ничего не записывается.
Appender мы используем как RollingFileAppender
и log4j.rootLogger=DEBUG
.
Кто-нибудь может подсказать, что может быть причиной этой проблемы?
Вот log4j.properties для проекта.
log4j.rootLogger= DEBUG, ConsoleAppender, Rolling
log4j.appender.ConsoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.ConsoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ConsoleAppender.layout.ConversionPattern=%d %-2p %c.%M(): %m%n
log4j.appender.Rolling=org.apache.log4j.RollingFileAppender
log4j.appender.Rolling.MaxFileSize=5MB
log4j.appender.Rolling.MaxBackupIndex=2
log4j.appender.Rolling.File=D:\Logs\myProj.log
log4j.appender.Rolling.layout = org.apache.log4j.PatternLayout
log4j.appender.Rolling.layout.ConversionPattern=%d %-4p %c.%M(): %m%n
## Following two lines have been removed now.
log4j.logger.com=WARN
log4j.logger.org=WARN
Получено Войдите в файл журнала:
2012-01-16 22:02:08,534 DEBUG org.apache.http.headers.receiveResponseHeader(): << content-type: application/json; charset=UTF-8
2012-01-16 22:02:08,534 DEBUG org.apache.http.headers.receiveResponseHeader(): << connection: close
2012-01-16 22:02:08,534 DEBUG org.apache.http.headers.receiveResponseHeader(): << content-length: 236
2012-01-16 22:02:08,550 DEBUG org.apache.http.headers.receiveResponseHeader(): << server: httpd.js
2012-01-16 22:02:08,550 DEBUG org.apache.http.headers.receiveResponseHeader(): << date: Tue, 17 Jan 2012 03:02:06 GMT
2012-01-16 22:02:08,566 DEBUG org.apache.http.wire.wire(): << "{"name":"clickElement","sessionId":"2fad55cf-670e-44f3-ab60-7d2f76f641e6","status":0,"value":"This action is final and cannot be undone?"}"
2012-01-16 22:02:08,566 DEBUG org.apache.http.impl.conn.DefaultClientConnection.shutdown(): Connection shut down
2012-01-16 22:02:08,566 DEBUG org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.releaseConnection(): Released connection is not reusable.
2012-01-16 22:02:08,566 DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute.freeEntry(): Releasing connection [HttpRoute[{}->http://127.0.0.1:7055]][null]
2012-01-16 22:02:08,566 DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute.notifyWaitingThread(): Notifying no-one, there are no waiting threads
2012-01-16 22:02:10,566 DEBUG org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.getConnection(): Get connection: HttpRoute[{}->http://127.0.0.1:7055], timeout = 120000
2012-01-16 22:02:10,566 DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(): [HttpRoute[{}->http://127.0.0.1:7055]] total kept alive: 0, total issued: 0, total allocated: 0 out of 2000
2012-01-16 22:02:10,566 DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getFreeEntry(): No free connections [HttpRoute[{}->http://127.0.0.1:7055]][null]
2012-01-16 22:02:10,566 DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(): Available capacity: 2000 out of 2000 [HttpRoute[{}->http://127.0.0.1:7055]][null]
2012-01-16 22:02:10,581 DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute.createEntry(): Creating new connection [HttpRoute[{}->http://127.0.0.1:7055]]
2012-01-16 22:02:10,597 DEBUG org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(): Connecting to 127.0.0.1:7055
2012-01-16 22:02:10,597 DEBUG org.apache.http.client.protocol.RequestAddCookies.process(): CookieSpec selected: best-match
2012-01-16 22:02:10,597 DEBUG org.apache.http.client.protocol.RequestAuthCache.process(): Auth cache not set in the context
2012-01-16 22:02:10,597 DEBUG org.apache.http.impl.client.DefaultHttpClient.tryExecute(): Attempt 1 to execute request
2012-01-16 22:02:10,597 DEBUG org.apache.http.impl.conn.DefaultClientConnection.sendRequestHeader(): Sending request: GET /hub/session/2fad55cf-670e-44f3-ab60-7d2f76f641e6/alert_text HTTP/1.1
2012-01-16 22:02:10,597 DEBUG org.apache.http.wire.wire(): >> "GET /hub/session/2fad55cf-670e-44f3-ab60-7d2f76f641e6/alert_text HTTP/1.1[\r][\n]"
2012-01-16 22:02:10,597 DEBUG org.apache.http.wire.wire(): >> "Accept: application/json, image/png[\r][\n]"
2012-01-16 22:02:10,597 DEBUG org.apache.http.wire.wire(): >> "Host: 127.0.0.1:7055[\r][\n]"
2012-01-16 22:02:10,597 DEBUG org.apache.http.wire.wire(): >> "Connection: Keep-Alive[\r][\n]"
2012-01-16 22:02:10,597 DEBUG org.apache.http.wire.wire(): >> "[\r][\n]"
2012-01-16 22:02:10,597 DEBUG org.apache.http.headers.sendRequestHeader(): >> GET /hub/session/2fad55cf-670e-44f3-ab60-7d2f76f641e6/alert_text HTTP/1.1
2012-01-16 22:02:10,597 DEBUG org.apache.http.headers.sendRequestHeader(): >> Accept: application/json, image/png
2012-01-16 22:02:10,597 DEBUG org.apache.http.headers.sendRequestHeader(): >> Host: 127.0.0.1:7055
2012-01-16 22:02:10,597 DEBUG org.apache.http.headers.sendRequestHeader(): >> Connection: Keep-Alive
2012-01-16 22:02:10,612 DEBUG org.apache.http.wire.wire(): << "HTTP/1.1 200 OK[\r][\n]"
2012-01-16 22:02:10,612 DEBUG org.apache.http.wire.wire(): << "content-type: application/json; charset=UTF-8[\r][\n]"
2012-01-16 22:02:10,612 DEBUG org.apache.http.wire.wire(): << "connection: close[\r][\n]"
2012-01-16 22:02:10,612 DEBUG org.apache.http.wire.wire(): << "content-length: 236[\r][\n]"
2012-01-16 22:02:10,612 DEBUG org.apache.http.wire.wire(): << "server: httpd.js[\r][\n]"
2012-01-16 22:02:10,612 DEBUG org.apache.http.wire.wire(): << "date: Tue, 17 Jan 2012 03:02:10 GMT[\r][\n]"
2012-01-16 22:02:10,612 DEBUG org.apache.http.wire.wire(): << "[\r][\n]"
2012-01-16 22:02:10,612 DEBUG org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(): Receiving response: HTTP/1.1 200 OK