I am trying to use logback while running my ap outside of project ( inside the JAR file ). I have tried to move it in the root folder and run it with the following command:
java -Dlogback.configurationFile=conf/logback.xml -jar xxxxx.jar
but it didn't work.When I am running the project from intelliJ
everything work as expecte but when I build the artifacts it doesn't work anymore.
I am using JavaFX with dependencies, I don't use maven.
My Logback xml file is this:
<configuration>
<timestamp key="TIMESTAMP" datepattern="HHmmss"/>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${user.home}/vlcj-${TIMESTAMP}.log</file>
<append>false</append>
<encoder>
<pattern>%-36(%d{HH:mm:ss.SSS} [%thread]) %-5level %72logger{72} - %msg%n</pattern>
</encoder>
</appender>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-36(%d{HH:mm:ss.SSS} [%thread]) %-5level %72logger{72} - %msg%n</pattern>
</encoder>
</appender>
<logger name="ch" level="ERROR"/>
<logger name="org" level="ERROR"/>
<logger name="com" level="ERROR"/>
<logger name="uk.co.caprica.vlcj" level="DEBUG"/>
<root level="debug">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
I get the following error:
10:43:01,092 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT
find resource [logback.groovy]
10:43:01,092 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found res
ource [logback-test.xml] at [jar:file:/D:/DigiStorageStreamer/out/artifacts/Digi
StorageStreamer/DigiStorageStreamer.jar!/logback-test.xml]
10:43:01,099 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@6af6
b7d7 - URL [jar:file:/D:/DigiStorageStreamer/out/artifacts/DigiStorageStreamer/D
igiStorageStreamer.jar!/logback-test.xml] is not of type file
10:43:01,126 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction -
debug attribute not set
10:43:01,127 |-ERROR in ch.qos.logback.core.joran.action.TimestampAction - Attri
bute named [datePattern] cannot be empty
10:43:01,127 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Using
current interpretation time, i.e. now, as time reference.
10:43:01,127 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About t
o instantiate appender of type [ch.qos.logback.core.FileAppender]
10:43:01,131 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming
appender as [FILE]
10:43:01,144 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA
- Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] fo
r [encoder] property
10:43:01,161 |-INFO in ch.qos.logback.core.FileAppender[FILE] - File property is
set to [C:\Users\Marian Pavel/vlcj-TIMESTAMP_IS_UNDEFINED.log]
10:43:01,163 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About t
o instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
10:43:01,163 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming
appender as [CONSOLE]
10:43:01,164 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA
- Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] fo
r [encoder] property
10:43:01,165 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Settin
g level of logger [ch] to ERROR
10:43:01,165 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Settin
g level of logger [org] to ERROR
10:43:01,165 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Settin
g level of logger [com] to ERROR
10:43:01,165 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Settin
g level of logger [uk.co.caprica.vlcj] to DEBUG
10:43:01,165 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Se
tting level of ROOT logger to DEBUG
10:43:01,165 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Atta
ching appender named [CONSOLE] to Logger[ROOT]
10:43:01,166 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Atta
ching appender named [FILE] to Logger[ROOT]
10:43:01,166 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction -
End of configuration.
10:43:01,166 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@2ffd1032 -
Registering current configuration as safe fallback point
10:43:01.221 [JavaFX Application Thread] INFO
uk.co.caprica.vlcj.Info - vlcj: 3.9.0
10:43:01.223 [JavaFX Application Thread] INFO
uk.co.caprica.vlcj.Info - java: 1.8.0_66 Oracle Corporation
10:43:01.223 [JavaFX Application Thread] INFO
uk.co.caprica.vlcj.Info - java home: C:\Program Files\Java\jre1.
8.0_66
10:43:01.224 [JavaFX Application Thread] INFO
uk.co.caprica.vlcj.Info - os: Windows 10 10.0 amd64
Exception in thread "JavaFX Application Thread" java.lang.UnsatisfiedLinkError:
Unable to load library 'libvlc': JNA native support (win32-amd64/libvlc.dll) not
found in resource path (DigiStorageStreamer.jar)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:220)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:322)
at com.sun.jna.Library$Handler.<init>(Library.java:142)
at com.sun.jna.Native.loadLibrary(Native.java:387)
at com.sun.jna.Native.loadLibrary(Native.java:366)
at uk.co.caprica.vlcj.binding.LibVlc.<clinit>(LibVlc.java:115)
at Player.<init>(Player.java:72)
at Main$1.handle(Main.java:86)
at Main$1.handle(Main.java:63)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unkn
own Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(U
nknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$KeyHandler.process(Unknown Source)
at javafx.scene.Scene$KeyHandler.access$1800(Unknown Source)
at javafx.scene.Scene.impl_processKeyEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.keyEvent(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.
run(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.
run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent
$353(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown
Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(Unknow
n Source)
at com.sun.glass.ui.View.handleKeyEvent(Unknown Source)
at com.sun.glass.ui.View.notifyKey(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Change your " <timestamp key="TIMESTAMP" datepattern="HHmmss"/>
" in the xml to "datePattern
" with uppercase "P"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With