2017-01-11 55 views
5

Okay faceci próbuję skonfigurować logback-spring.xml.Konfiguracja logback live reload (scan = true) z Spring-Boot

Moim celem jest automatyczne ponowne załadowanie pliku konfiguracyjnego po modyfikacji.

Więc to co doc mówi:

OD:

<configuration> 
    ... 
</configuration> 

TO:

<configuration scan="true" scanPeriod="30 seconds"> 
    ... 
</configuration> 

Nie ma wątpliwości, że jeśli nie używam żadnych elementów jak:

<springProperty> 

lub

<springProfile> 

Przeładowanie na żywo działa bez żadnych problemów. Również jeśli nie używam scan="true"springProfile i springProperty, działają one również doskonale.

Mój wniosek jest taki, że elementy spring i scan nie lubią się nawzajem. Dostaję od błędów typu:

16:29:39,101 |-ERROR in [email protected]:125 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]] 
16:29:39,102 |-ERROR in [email protected]:109 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]] 
16:29:39,102 |-ERROR in [email protected]:64 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]] 
16:29:39,103 |-ERROR in [email protected]:29 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]] 
16:29:39,103 |-ERROR in [email protected]:70 - no applicable action for [appender], current ElementPath is [[configuration][springProfile][appender]] 
16:29:39,103 |-ERROR in [email protected]:13 - no applicable action for [encoder], current ElementPath is [[configuration][springProfile][appender][encoder]] 
16:29:39,103 |-ERROR in [email protected]:14 - no applicable action for [pattern], current ElementPath is [[configuration][springProfile][appender][encoder][pattern]] 
16:29:39,104 |-ERROR in [email protected]:12 - no applicable action for [append], current ElementPath is [[configuration][springProfile][appender][append]] 
16:29:39,104 |-ERROR in [email protected]:10 - no applicable action for [file], current ElementPath is [[configuration][springProfile][appender][file]] 
16:29:39,104 |-ERROR in [email protected]:70 - no applicable action for [appender], current ElementPath is [[configuration][springProfile][appender]] 
16:29:39,104 |-ERROR in [email protected]:13 - no applicable action for [encoder], current ElementPath is [[configuration][springProfile][appender][encoder]] 
16:29:39,104 |-ERROR in [email protected]:14 - no applicable action for [pattern], current ElementPath is [[configuration][springProfile][appender][encoder][pattern]] 
16:29:39,105 |-ERROR in [email protected]:12 - no applicable action for [append], current ElementPath is [[configuration][springProfile][appender][append]] 
16:29:39,105 |-ERROR in [email protected]:10 - no applicable action for [file], current ElementPath is [[configuration][springProfile][appender][file]] 
16:29:39,105 |-ERROR in [email protected]:70 - no applicable action for [appender], current ElementPath is [[configuration][springProfile][appender]] 
16:29:39,105 |-ERROR in [email protected]:13 - no applicable action for [encoder], current ElementPath is [[configuration][springProfile][appender][encoder]] 
16:29:39,106 |-ERROR in [email protected]:14 - no applicable action for [pattern], current ElementPath is [[configuration][springProfile][appender][encoder][pattern]] 
16:29:39,106 |-ERROR in [email protected]:12 - no applicable action for [append], current ElementPath is [[configuration][springProfile][appender][append]] 
16:29:39,106 |-ERROR in [email protected]:10 - no applicable action for [file], current ElementPath is [[configuration][springProfile][appender][file]] 
16:29:39,106 |-ERROR in [email protected]:70 - no applicable action for [appender], current ElementPath is [[configuration][springProfile][appender]] 
16:29:39,106 |-ERROR in [email protected]:13 - no applicable action for [encoder], current ElementPath is [[configuration][springProfile][appender][encoder]] 
16:29:39,107 |-ERROR in [email protected]:14 - no applicable action for [pattern], current ElementPath is [[configuration][springProfile][appender][encoder][pattern]] 
16:29:39,107 |-ERROR in [email protected]:12 - no applicable action for [append], current ElementPath is [[configuration][springProfile][appender][append]] 
16:29:39,107 |-ERROR in [email protected]:10 - no applicable action for [file], current ElementPath is [[configuration][springProfile][appender][file]] 
16:29:39,107 |-ERROR in ch.qos.logback.core.joran.spi.Interpret[email protected]:70 - no applicable action for [appender], current ElementPath is [[configuration][springProfile][appender]] 
16:29:39,107 |-ERROR in [email protected]:13 - no applicable action for [encoder], current ElementPath is [[configuration][springProfile][appender][encoder]] 
16:29:39,107 |-ERROR in [email protected]:14 - no applicable action for [pattern], current ElementPath is [[configuration][springProfile][appender][encoder][pattern]] 
16:29:39,108 |-ERROR in [email protected]:12 - no applicable action for [append], current ElementPath is [[configuration][springProfile][appender][append]] 
16:29:39,108 |-ERROR in [email protected]:10 - no applicable action for [file], current ElementPath is [[configuration][springProfile][appender][file]] 
16:29:39,108 |-ERROR in [email protected]:53 - no applicable action for [logger], current ElementPath is [[configuration][springProfile][logger]] 
16:29:39,108 |-ERROR in [email protected]:35 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][logger][appender-ref]] 
16:29:39,108 |-ERROR in [email protected]:54 - no applicable action for [logger], current ElementPath is [[configuration][springProfile][logger]] 
16:29:39,108 |-ERROR in [email protected]:35 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][logger][appender-ref]] 
16:29:39,108 |-ERROR in [email protected]:23 - no applicable action for [logger], current ElementPath is [[configuration][springProfile][logger]] 
16:29:39,108 |-ERROR in [email protected]:35 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][logger][appender-ref]] 
16:29:39,109 |-ERROR in [email protected]:37 - no applicable action for [logger], current ElementPath is [[configuration][springProfile][logger]] 
16:29:39,109 |-ERROR in [email protected]:35 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][logger][appender-ref]] 
16:29:39,109 |-ERROR in [email protected]:54 - no applicable action for [logger], current ElementPath is [[configuration][springProfile][logger]] 
16:29:39,109 |-ERROR in [email protected]:35 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][logger][appender-ref]] 
16:29:39,109 |-ERROR in [email protected]:54 - no applicable action for [logger], current ElementPath is [[configuration][springProfile][logger]] 
16:29:39,109 |-ERROR in [email protected]:35 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][logger][appender-ref]] 
16:29:39,109 |-ERROR in [email protected]:23 - no applicable action for [root], current ElementPath is [[configuration][springProfile][root]] 
16:29:39,109 |-ERROR in [email protected]:35 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]] 
16:29:39,109 |-ERROR in [email protected]:28 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]] 
16:29:39,110 |-ERROR in [email protected]:72 - no applicable action for [appender], current ElementPath is [[configuration][springProfile][appender]] 
16:29:39,110 |-ERROR in [email protected]:13 - no applicable action for [encoder], current ElementPath is [[configuration][springProfile][appender][encoder]] 
16:29:39,110 |-ERROR in [email protected]:14 - no applicable action for [pattern], current ElementPath is [[configuration][springProfile][appender][encoder][pattern]] 
16:29:39,110 |-ERROR in [email protected]:14 - no applicable action for [charset], current ElementPath is [[configuration][springProfile][appender][encoder][charset]] 
16:29:39,110 |-ERROR in [email protected]:76 - no applicable action for [appender], current ElementPath is [[configuration][springProfile][appender]] 
16:29:39,110 |-ERROR in [email protected]:13 - no applicable action for [encoder], current ElementPath is [[configuration][springProfile][appender][encoder]] 
16:29:39,110 |-ERROR in [email protected]:14 - no applicable action for [pattern], current ElementPath is [[configuration][springProfile][appender][encoder][pattern]] 
16:29:39,110 |-ERROR in [email protected]:14 - no applicable action for [charset], current ElementPath is [[configuration][springProfile][appender][encoder][charset]] 
16:29:39,110 |-ERROR in [email protected]:54 - no applicable action for [logger], current ElementPath is [[configuration][springProfile][logger]] 
16:29:39,110 |-ERROR in [email protected]:38 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][logger][appender-ref]] 
16:29:39,111 |-ERROR in [email protected]:23 - no applicable action for [root], current ElementPath is [[configuration][springProfile][root]] 
16:29:39,111 |-ERROR in [email protected]:34 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]] 

Tak jak już powiedziałem, jeśli usunę scan=true konfiguracja działa. Jeśli usuniemy springProfiles i właściwości i opuścić scan=true konfiguracja działa ponownie, ale z OBU coś nie jest w porządku?

Zakładam, że jest to najprawdopodobniej niemożliwe, ale czy ktoś znalazł sposób na zrobienie tego?

EDYTOWANIE: Blisko tydzień po opublikowaniu mojego pytania Wiosna zaktualizowano ich documentation. Nadal szukam odpowiedzi i przypuszczam, że może istnieć sposób, że może za pomocą jakiejś środkowej warstwy pliku właściwości między właściwościami sprężynowymi a plikiem konfiguracji logback, ponieważ dokumentacja logbackowa mówi, że możesz importować pliki właściwości do konfiguracji. Ale nadal, nawet jeśli tak, problem z springProfile pozostaje.

Odpowiedz