Closed AndrewG10i closed 3 years ago
Hi @Andrew-Gr, thank you for detailed investigation. I've reproduced the issue easily and raised internal issue FISH-450
.
Hi @AndrewG10i
Is this still an issue? we tried with
java -jar target/demo-microbundle.jar --logtofile rudy.log
And log file is created as expected.
Thx Rudy
Hello @rdebusscher,
yes, I do confirm that issue still present with Payara Micro 5.2021.7. Description provided in the initial post still valid, issue reproduces with the uber jar. We still use the same approach: by commenting out payaramicro.logPropertiesFile
prop inside resulting uber jar (MICRO-INF/deploy/payaramicro.properties
) - helps to resolve the issue.
Let me know if you need us to provide a reproducer.
Thank you!
Hi @AndrewG10i
This is the usecase we have tested.
curl -O -J 'https://start.microprofile.io/api/project?supportedServer=PAYARA_MICRO&selectedSpecs=CONFIG'
unzip demo.zip
mvn clean package
java -jar target/demo-microbundle.jar --logtofile rudy.log
Please let us known how you create and use the uberjar of Payara Micro.
Rudy
Hi @rdebusscher,
I see now what you mean. I am referring to a different approach, sorry for not clarifying it in my original post. I have just corrected it and extended initial post with the steps on reproducing the issue. Sorry again for wasting your time while trying to figure out what did I mean...!
Thank you!
Hi @AndrewG10i
You are correct, using the uberJar creation facilities of Payara Micro itself, results in the problem you have described. But not when you are using the Payara Micro Maven Plugin.
By adding
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.0.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<configuration>
<payaraVersion>5.2021.7</payaraVersion>
</configuration>
</plugin>
You also have an uber jar and it is much easier
For Payara Enterprise Customers we can consider fixing this, with low priority as there is a workaround, but we decided not to fix this ourselves for the community. You are encouraged to submit a PR yourself where the changed code gives priority to the --logtofile option over the embedded or specified logging properties file.
Rudy
Description
--logToFile
option doesn't work when used with Uber Jar, it always returns:As result - no log file is created as well.
Expected Outcome
Log file should be created according to the provided param
--logToFile
Current Outcome
No log file created and WARNING log message always printed to console.
Steps for reproducing the issue
https://github.com/AndrewG10i/JsfSampleApp
JsfSampleApp-trunk.zip
cd JsfSampleApp-trunk && mvn package
java -jar payara-micro-5.2021.7.jar --deploy JsfSampleApp-trunk\target\jsfDebug-1.0.war; --outputUberJar jsfSampleApp.jar
java -jar jsfSampleApp.jar --logToFile D:\server.log
-> as result no log fileD:\server.log
created and also while launching the server you can see the following output in console:WARNING: logToFile command line option ignored as a logging.properties file has been provided
(almost the most 1st line in console output)#payaramicro.logPropertiesFile=false
line insidejsfSampleApp.jar\MICRO-INF\deploy\payaramicro.properties
and launch it again in the same way:java -jar jsfSampleApp.jar --logToFile D:\server.log
-> you can see a log file successfully created.Investigation of the root cause
So you can see the code added in 5.2020.4 (PayaraMicroImpl.java):
The issue that in case of uber jar USER_PROPS_FILE ("MICRO-INF/deploy/payaramicro.properties") always contains value like:
payaramicro.logPropertiesFile=false|true
As result
if (userLogPropertiesFileStr != null && !userLogPropertiesFileStr.trim().isEmpty())
always gives trueI was able to confirm this theory simply by renaming
payaramicro.logPropertiesFile=false
intopayaramicro.logPropertiesFile1=false
in USER_PROPS_FILE inside uber jar, after that logging to file started working fine again.It would be very nice if you could include the fix for this issue in the next release.
Thank you!