Bug 963778

Summary: Value of the handler.FILE.fileName property in logging.properties changed after first launch
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Dominik Pospisil <dpospisi>
Component: LoggingAssignee: James Perkins <jperkins>
Status: CLOSED WONTFIX QA Contact: Nikoleta Hlavickova <nziakova>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbaranow, cdewolf, ehugonne, jboss-set, jowest, jperkins, klape, nziakova, pkremens
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-16 15:46:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dominik Pospisil 2013-05-16 14:27:23 UTC
The default value of the handler.FILE.fileName property in standalone/configuraion is changed after first launch.

The default value is:
${org.jboss.boot.log.file:boot.log}

After first launch, the value is replaced by absolute path of the referenced log file. e.g.

/home/dpospisi/runtimes/jboss-eap-6.1.ER8/standalone/log/server.log

This might cause issues if the server is moved to another directory and the original location is made unaccessible.

Caused by: java.io.FileNotFoundException: /home/dpospisi/runtimes/jpp-6.1-prod-prev/jboss-jpp-6.1/standalone/log/server.log (No such file or directory)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
	at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:154)
	at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.setFile(PeriodicRotatingFileHandler.java:105)
	at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:192)
	a

Comment 1 James Perkins 2013-05-16 20:01:50 UTC
We had some discussions around this before the freeze. I had a PR that did write out expressions back to the logging.properties, but there were some issues with and we didn't have time to work them all out and test them.

There is still an outstanding JIRA for this as well, https://issues.jboss.org/browse/WFLY-234.

Comment 2 JBoss JIRA Server 2013-06-06 22:09:54 UTC
James Perkins <jperkins> made a comment on jira WFLY-234

Main issue with writing expressions is system properties, at least as defined in the XML configurations, aren't available at the time they are needed to resolve the expressions.

Comment 6 Josh West 2014-04-09 13:48:00 UTC
Voting for a fix on this bug short term. Numerous customers in my patch expect and need the JBoss server installation to be self-contained, and to be portable to different directories.  Issues like this break that functionality with EAP as well as layer products. 

We more customers build cloud automation with differing strategies this expectation that our product is more portable is a key part of the 'cloud readiness' value proposition.

Comment 7 James Perkins 2014-04-14 18:03:16 UTC
I've update the JIRA to target WildFly 9. When complete we can backport to EAP 6.x. Whether or no it makes 6.3 is up in the air really. Off the top of my head I don't see it being a huge issue, but it's been quite a while since I've looked at it.

Comment 8 James Perkins 2014-04-16 00:20:09 UTC
Copying the comment from the WF JIRA:

I started experimenting with and I just can't find a decent workaround for the system property resolution.

We'll just assume the default settings of jboss.server.log.dir for the relative-to and server.log for the path. In the logging.properties file it would look something like:

handler.FILE.fileName=${jboss.server.log.dir}/server.log

The issue is the system property jboss.server.log.dir is not set before the log manager is configured. This property is generally set during the main entry point of the server and the log manager is configured in the main entry point of jboss-modules. The only way this would work is if the value for the relative-to was also set in the JAVA_OPTS.

More over setting a custom path the user would have to add the path to the JAVA_OPTS as well. I can't see a way to resolve which path is being used by the time the log manager is configured. While just using a relative-to path is an example, the same would be true for any property.

Comment 10 James Perkins 2014-09-16 15:46:08 UTC
This will not be done for EAP 6. As the previous comment states there are issues around setting system properties for the log manager as it's one of the first things configured. If an issue is filed for a feature request for EAP 7 it would definitely be considered.