๐ป Programming
์คํ๋ง ํ๋ก์ ํธ logback ์ค์ ์ค๋ฅ (Could not find Janino library on the class path)
์คํ๋ง ํ๋ก์ ํธ์์ logback์ ์ด์ฉํ์ฌ ํ๊ฒฝ๋ณ๋ก ๋ก๊ทธ ์ค์ ์ ๋ค๋ฅด๊ฒ ํ ๋
<if>, <elseif> ๋ฑ์ ํ๊ทธ๋ฅผ ์ด์ฉํ ์ ์๋ ์ค ์๊ณ ์๋์ฒ๋ผ ์ค์ ์ ํด๋ณด์๋ค.
<if condition="property('myproject.profile').equals('live')">
<logger name="com.myproject" level="debug">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.springframework" level="WARN"/>
<root level="info"/>
</if>
<elseif condition="property('myproject.profile').equals('dev')">
<logger name="com.myproject" level="debug">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.springframework" level="WARN"/>
<root level="info"/>
</elseif>
<else condition="property('myproject.profile').equals('local')">
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</else>
์ ์ฒ๋ผ ์ค์ ํ๋๋ฐ ์ฑ ๊ธฐ๋ ์ ์๋์ฒ๋ผ logback์์ ์๋ฌ๋ก๊ทธ๋ฅผ ์ฐ์๋ค.
14:46:24,662 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
14:46:24,668 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
14:46:24,668 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
14:46:24,668 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
14:46:24,673 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - Could not find Janino library on the class path. Skipping conditional processing.
14:46:24,673 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - See also http://logback.qos.ch/codes.html#ifJanino
14:46:24,673 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:64 - no applicable action for [logger], current ElementPath is [[configuration][if][logger]]
14:46:24,674 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@32:42 - no applicable action for [appender-ref], current ElementPath is [[configuration][if][logger][appender-ref]]
์์ธ์ ๋ช ํํด๋ณด์๋ค. Janino๋ผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์์ด์์๋ค.
<if>, <elseif> ๋ฑ์ ํ๊ทธ๋ฌธ๋ฒ์ Janino ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ํด์์ ํด์ฃผ๋๋ฐ ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์์ด์ logback ์ค์ ํ์ผํด์์ ์ ๋๋ก ๋ชปํ ์ํ์๋ค.
๊ทธ๋์ ํ์ฌ์ผ์ ๊ฐ์ฅ ์ต์ ๋ฒ์ ์ผ๋ก ์์กด์ฑ์ ์ถ๊ฐํ๋ค.
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.0.14</version>
</dependency>
๊ทธ๋ฐ๋ฐ ๋ ์ค๋ฅ๊ฐ ๋ฌ๋ค ใ ใ
Failed to parse condition [property('myproject.profile').equals('live')] org.codehaus.commons.compiler.CompileException: Line 1, Column 45: Closing single quote missing
at org.codehaus.commons.compiler.CompileException: Line 1, Column 45: Closing single quote missing
์กฐ๊ฑด์ผ๋ก ์ค๊ฒ ํ์ฑ์ค๋ฅ๊ฐ ๋ฌ๋จ๋ค. ๊ทธ๋์ ์ปจ๋์ ์ ์๋์ฒ๋ผ ๋ฐ๊พธ์๋ค.
<if condition='property("myproject.profile").equals("local")'>
์๋ฐ์ดํ์ ํ๋ฐ์ดํ๋ฅผ ๋ฐ๊พผ๊ฑฐ๋ค.
๊ทธ๋ฆฌ๊ณ if-else if - else ๋ฅผ ํ๊ธฐ์ํด์ nested if๋ฅผ ์จ์ผํ๋ค.
ํ์ง๋ง nested <if> ๋ฅผ ์ฐ๊ธฐ์ ์์ชฝ์ผ๋ก ์ธ๋ดํธ ๋๋ ๊ฒ ๋ง์์ ธ์ ๊ฐ๋ ์ฑ์ด ๋จ์ด์ง๋ค.
์ด์ฐจํผ ์กฐ๊ฑด์ equals๋ก ๋น๊ตํ๊ณ ์์ผ๋
๊ฒฐ๊ณผ์ ์ผ๋ก if๋ฌธ๋ง ์จ์ profile๊ฐ์ ๋น๊ตํด์ฃผ์ด๋ if-elseif์ ํจ๊ณผ๋ ๋ณผ ์ ์์ผ๋ฏ๋ก ์๋์ฒ๋ผ ๋ฐ๊ฟจ๋ค.
<if condition='property("myproject.profile").equals("live")'>
<then>
<logger name="com.myproject" level="debug">
<appender-ref ref="ELASTIC"/>
</logger>
<logger name="org.springframework" level="WARN"/>
<root level="info"/>
</then>
</if>
<if condition='property("myproject.profile").equals("dev")'>
<then>
<logger name="com.myproject" level="debug">
<appender-ref ref="ELASTIC"/>
</logger>
<logger name="org.springframework" level="WARN"/>
<root level="info"/>
</then>
</if>
<if condition='property("myproject.profile").equals("local")'>
<then>
<logger name="com.myproject" level="debug">
<appender-ref ref="STDOUT"/>
</logger>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
</then>
</if>
์ด์ ์ ๋์ํ๋ค.
'๐ป Programming' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[AWS DynamoDB] Conditional Check Failed Exception (0) | 2019.12.18 |
---|---|
์ดํด๋ฆฝ์ค ํ๋ก์ ํธ ๋ถ๋ฌ์ค๊ธฐ (Eclipse project import) (0) | 2019.08.06 |
jackson.core ์ค๋ฅ (java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonStreamContext.<init>(II)V) (0) | 2019.07.24 |
[Node.js] npm ์ ๋ฐ์ดํธ ํ๊ธฐ (0) | 2019.07.03 |
์คํ๋ง๋ถํธ ์ค์ผ์ฅด๋ฌ ์ฌ์ฉํ๊ธฐ (0) | 2019.06.08 |