Ruslan  Gabbazov Ruslan Gabbazov - 1 year ago 207
Java Question

lost Logback configuration in launch4j

I ran into a strange problem to me, and I ask your help. Judging by the fact that my search has not given definite results, I just forgot something obvious, but I can not understand what it was.

So, there is a program on Java. Logback configuration (logback.xml in "resources" path):

<property resource=".\app\" />
<appender name="STDOUT-BLACK"
<appender name="STDOUT-RED" class="ch.qos.logback.core.ConsoleAppender">

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<Pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</Pattern>

<logger name="org.hibernate.type" level="TRACE" />
<logger name="org.hibernate.SQL" level="DEBUG" />

<root level="DEBUG">
<appender-ref ref="STDOUT-BLACK" />
<appender-ref ref="STDOUT-RED" />
<appender-ref ref="FILE" />

the additional configuration file is (resources\app\


And it works fine in NetBeans.

BUT whean I make an Exe for Windows from this (using Gradle shadow and launch4j plugins) properties file seems to be ignorred. Each time I start my exe I have a file (in the same folder, as exe file) "destination_IS_UNDEFINED", where all my logs are stored correct. If I "hardcode" the file name in "logback.xml" all works as expected, but why he can't read "properties"? They are in Jar, from which Launch4j creates an exe, and I got there also some other properties Files, which program read correct.

<property resource=".\app\" />

The error is somewhere here... I tried different "/" as separator, but it haven't helped anyhow. What am I doung wrong?

And actually I have one more question: which is the right way to store properties otside Jar file? I mean it would be nice to have a folder, where all my properties are (just as it is in IDE), and user may change them without recompile the project (so the "*.exe" Program must "read" it from this folder instead of Jar). I'm sure it's made 1000 times by everione. Is there any sample or explanation about it anywhere (maybe I'm just looking for the wrong, because I know English is not enough, so I can not find what I need).

Thanks a lot!

So, the first "Problem" is solved, and it was really silly - there was just an extra point. Does anyone have any advice about the second question?

Answer Source

I would like to check the following line in the XML

<property resource=".\app\" />

Are you sure about the location of app folder?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download