J'utilise la jetée pour implémenter le client websocket. Cela produit beaucoup de bruit dans le fichier journal au démarrage de l'application et lors de la reconnexion de la socket websocket. En fait, en cas d'échec de la connexion websocket je suis une nouvelle tentative après une minute si après chaque minute il il produire ce genre de journal:Comment arrêter la connexion dans l'application de jetée
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.log:173 - Logging to Logger[org.eclipse.jetty.util.log] via org.eclipse.jetty.util.log.Slf4jLog
2017-06-12 14:23:04 | INFO | [main] c.h.h.v.c.WebSocketListener:53 - STARTING WS Client
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected]
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.w.c.WebSocketClient:157 - Starting [email protected]
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.ContainerLifeCycle:302 - [email protected] added {[email protected]{STOPPED,8<=0<=200,i=0,q=0},AUTO}
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.ContainerLifeCycle:302 - [email protected] added {[email protected],POJO}
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.ContainerLifeCycle:302 - [email protected] added {[email protected]7,AUTO}
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.ContainerLifeCycle:302 - [email protected] added {[email protected],AUTO}
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected]{STOPPED,8<=0<=200,i=0,q=0}
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected]{STARTED,8<=8<=200,i=7,q=0}
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected]7
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected]7
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected]
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.ContainerLifeCycle:302 - [email protected] added {org.e[email protected]1cbbbc31,AUTO}
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting org.e[email protected]1cbbbc31
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected] keys=-1 selected=-1
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.t.QueuedThreadPool:342 - [email protected]{STARTED,8<=8<=200,i=8,q=0} dispatched [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected] keys=-1 selected=-1
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:418 - Starting Thread[[email protected],5,main] on [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:443 - Selector loop waiting on select
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.t.QueuedThreadPool:342 - [email protected]{STARTED,8<=8<=200,i=7,q=0} dispatched [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected]8 keys=-1 selected=-1
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:418 - Starting Thread[[email protected],5,main] on [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:443 - Selector loop waiting on select
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.t.QueuedThreadPool:342 - [email protected]{STARTED,8<=8<=200,i=6,q=0} dispatched [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:184 - starting [email protected] keys=-1 selected=-1
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:418 - Starting Thread[[email protected],5,main] on [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:443 - Selector loop waiting on select
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.t.QueuedThreadPool:342 - [email protected]{STARTED,8<=8<=200,i=5,q=0} dispatched [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED org.e[email protected]1cbbbc31
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:418 - Starting Thread[[email protected],5,main] on [email protected] keys=0 selected=0
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected]
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:443 - Selector loop waiting on select
2017-06-12 14:23:04 | INFO | [main] o.e.j.w.c.WebSocketClient:196 - Started [email protected]
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.c.AbstractLifeCycle:177 - STARTED [email protected]
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.w.c.WebSocketClient:136 - connect websocket:[email protected] to:ws://localhost:9900
2017-06-12 14:23:04 | DEBUG | [main] o.e.j.u.t.QueuedThreadPool:342 - [email protected]{STARTED,8<=8<=200,i=4,q=0} dispatched [email protected]{true,false,null}
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:379 - Queued change [email protected]8ad23
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:446 - Selector loop woken up from select, 0/0 selected
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:406 - Running change [email protected]8ad23
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:443 - Selector loop waiting on select
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.i.SelectorManager:446 - Selector loop woken up from select, 1/1 selected
2017-06-12 14:23:04 | DEBUG | [[email protected]] o.e.j.w.c.i.WebSocketClientSelectorManager:56 - Connection Failed
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at org.eclipse.jetty.io.SelectorManager.finishConnect(SelectorManager.java:257)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.processConnect(SelectorManager.java:529)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.processKey(SelectorManager.java:502)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:455)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.run(SelectorManager.java:420)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:596)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:527)
at java.lang.Thread.run(Thread.java:745)
2017-06-12 14:23:04 | INFO | [[email protected]] c.h.h.v.c.WebSocketListener:94 - onWebSocketError:
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at org.eclipse.jetty.io.SelectorManager.finishConnect(SelectorManager.java:257)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.processConnect(SelectorManager.java:529)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.processKey(SelectorManager.java:502)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:455)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.run(SelectorManager.java:420)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:596)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:527)
at java.lang.Thread.run(Thread.java:745)
Voici mon fichier logback.xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="AUDITFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/visma-websocket-client.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/visma-websocket-client_%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>20MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%date %msg%n
</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="AUDITFILE" />
</root>
</configuration>
Quelqu'un peut-il donner Je suggère comment je peux réduire cette journalisation inutilisée car elle crée beaucoup d'espace disque lorsque le programme est en cours d'exécution. Je me demande est-il possible d'activer désactiver ce journal de la jetée de l'application ou en ajoutant un paramètre dans le fichier logback.xml
Augmenter le 'niveau' ?? – Oleg
vous voulez dire niveau = "DEBUG" à Info? Est-ce que cela aide aussi le niveau de journalisation de la jetée? – user565