Bug 918030 - Unable to read the logging configuration set by -Djboss.server.config.dir
Summary: Unable to read the logging configuration set by -Djboss.server.config.dir
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Scripts and Commands
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER7
: EAP 6.1.0
Assignee: James Perkins
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-05 10:52 UTC by Petr Kremensky
Modified: 2013-07-23 18:45 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
Console output with FileNotFoundException (3.48 KB, application/octet-stream)
2013-03-05 10:52 UTC, Petr Kremensky
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker AS7-6722 0 None None None 2015-11-17 12:12:01 UTC

Description Petr Kremensky 2013-03-05 10:52:27 UTC
Created attachment 705358 [details]
Console output with FileNotFoundException

If I move configuration files to external folder and run EAP I can see FileNotFoundException on the output. This was working with EAP6.0.1.GA.

move to folder with EAP and run:
mkdir config
cd config/
JBOSS_CONFIG_DIR=`pwd`
cd ..
mv jboss-eap-6.1/standalone/configuration/* config/
./jboss-eap-6.1/bin/standalone.sh -Djboss.server.config.dir=$JBOSS_CONFIG_DIR

-Djboss.domain.config.dir argument for domain is working fine,

Comment 3 James Perkins 2013-03-05 18:22:50 UTC
There is an issue in the standalone.sh script somewhere. This will need an upstream issue as well.

Comment 4 James Perkins 2013-03-05 18:38:11 UTC
Just some follow up information. The issue seems to be caused by quoting the parameters, https://github.com/jbossas/jboss-as/commit/922d259114e9b6dd9a3c5b5f14471e49d9cc1d8a#L3R27. This was a commit to fix https://issues.jboss.org/browse/AS7-5627.

Comment 5 Brian Stansberry 2013-03-06 19:00:05 UTC
IMO this needs to be fixed in 6.1. Being able to use -Djboss.server.config.dir is critical functionality.

Comment 6 James Perkins 2013-03-07 23:54:18 UTC
We need an upstream bug before we can fix this.

Comment 8 James Perkins 2013-03-13 20:55:09 UTC
The above PR needs to be reviewed by QE.

I'll explain what the actual error is. In the standalone.sh script the logging.properties file is passed in with a canonical path. This path is resolved in the script by looping through each JAVA_OPTS option from standalone.conf and each argument passed in from the command line. Since each parameter passed in via the command line is quoted, the case check in the script never finds the -Djboss.server.config.dir property passed in via the command line. This means for this to work the -Djboss.server.config.dir needs to be specified in the standalone.conf. (I'm singling out -Djboss.server.config.dir because it's really the only property regularly  used in the script)

Going back a bit there was an issue when parameters/properties with spaces in them were being split when passing to the JVM. AS7-5627 attempted to fix this by quoting each parameter passed via the command line. This is likely the right approach in a script, bur led to the issue above.

It should also be noted that passing the -Djboss.server.config.dir property only ever worked on Linux. BSD based systems (OS X) and Windows it never worked on. It always looks in $JBOSS_HOME/standalone/configuration for the logging.properties file.

Also a directory with a space in it has never worked, probably never spotted as that's rare on Linux.

The pull request linked above attempts to fix this issue, but does introduce possible other problems. On Windows it's more common to have spaces in paths. This commit does not address that and does led to some non-obvious error messages if a space is in the path. It also adds behavior for this to work on BSD based systems which previously was not supported. I have tested in Fedora 18, OS X and Windows 7. It does appear to work, but it doesn't work on ANY platform if there is a space in the path.

The question is what would be the preference from QE? Merging the pull request fixes the issue for Linux, but also attempts to fix it for BSD and Windows. The later two this never worked on before. 

The workaround to this issue on Linux would be to add the -Djboss.server.config.dir to the standalone.conf rather than passing in via the command line. If that is an acceptable workaround there is no reason for this PR to be merged.

Comment 9 Petr Kremensky 2013-03-15 12:08:32 UTC
James, this is not a question for QE. John Doyle should decide, which option is more acceptable from customers point of view.

I did some tests and scripts from your PR are working as you said. (I don't have Solaris results yet as there was some maintenance in lab)
https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/EAP6/view/EAP6-Scripts/job/eap-6x-scripts-config-dir-change-RHEL/
https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/EAP6/view/EAP6-Scripts/job/eap-6x-scripts-config-dir-change-Win/

I also notice, that this issue is quite same when it comes to special characters in path (see 
https://issues.jboss.org/browse/JBPAPP-10411 that was for EAP5). If you look at console outputs of runs with '#' and '$' in https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/EAP6/view/EAP6-SmokeTests/job/eap-60-server-startup-standalone-from_specialchar_inpath-RHEL-QE-smoke/ it is a quite same error. I tried to run same job with standalone.sh from PR but result was the same (see https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/EAP6/view/EAP6-Playground/job/eap-60-server-startup-standalone-from_specialchar_inpath-RHEL-QE-smoke-patch-test/)

Comment 10 James Perkins 2013-03-15 18:36:27 UTC
John, thoughts on the above? I've closed the PR until there is an okay to do this.

Comment 11 John Doyle 2013-03-22 20:26:34 UTC
I think the PR is a good step forward.  Go ahead with it.

Comment 12 JBoss JIRA Server 2013-03-26 02:15:11 UTC
James Perkins <jperkins> made a comment on jira AS7-6722

Pull request merged

Comment 13 Petr Kremensky 2013-04-11 10:21:56 UTC
I am still getting "Unable to read the logging configuration" message when trying this on SunOS machines with ER4. RHEL and Windows are ok. I tried it on Solaris 11.1 X86 with Oracle JDK 1.7.0_07 and Solaris 10 11/06 s10s_u3wos_10 SPARC with Oracle JDK 1.6.0_43, but I get this message for both standalone.sh and domain.sh.

Comment 14 JBoss JIRA Server 2013-04-11 18:57:05 UTC
James Perkins <jperkins> updated the status of jira AS7-6722 to Reopened

Comment 15 JBoss JIRA Server 2013-04-11 18:57:05 UTC
James Perkins <jperkins> made a comment on jira AS7-6722

Opening to allow for Solaris override.

Comment 17 JBoss JIRA Server 2013-04-17 18:29:59 UTC
James Perkins <jperkins> made a comment on jira AS7-6722

Pull request merged

Comment 19 Petr Kremensky 2013-04-22 08:49:19 UTC
Hi James,
I did some testing today and domain.bat script is broken too. Using -Djboss.domain.base.dir or -Djboss.domain.config.dir will throw "Unable to read logging configuration ..." message. Can you please fix also this.

I tested solaris patch from last PR and it's working fine so this should be the last one.

Thanks, Petr.

Comment 20 James Perkins 2013-04-22 15:56:25 UTC
Hello Petr,
Did the Windows path have a space in it? That is one limitation on *all* platforms that paths for this cannot have spaces.

Comment 21 James Perkins 2013-04-22 20:56:36 UTC
Oops, you're correct Petr. I missed it was domain.bat that was broken. I'll get a fix for that right away.

Comment 23 Petr Kremensky 2013-05-03 11:21:06 UTC
standalone.sh and domain.sh are still broken for Solaris 10 machines. Unfortunately when I tested PR I did it only on Sol 11, but now when run full OS matrix I can see it. Using -Djboss.server.config.dir, -Djboss.server.base.dir, -Djboss.domain.config.dir and -Djboss.domain.base.dir is still throwing "Unable to read the logging configuration... " message.

I also find out that -Djboss.domain.log.dir is ignored by domain.sh script. We use both JBOSS_LOG_DIR property and -Djboss.domain.log.dir switch in our tests so I didn't hit it, but now (ER6) when I use -Djboss.domain.log.dir these messages are thrown by domain.sh script before server startup:
./jboss-eap-6.1/bin/domain.sh: bad substitution
./jboss-eap-6.1/bin/domain.sh: darwin: not found
and default log location is used even if I specify JBOSS_LOG_DIR property. 

Using -Djboss.standalone.log.dir will also throw "bad substitution". Server.log is created to intended location, but there is also server.log file in default location (this is original boot.log file)

Only Solaris 10 machines are affected by this.

Comment 24 Petr Kremensky 2013-05-03 13:23:36 UTC
"./jboss-eap-6.1/bin/domain.sh: darwin: not found" message is thrown by domain.sh script everytime on all RHEL and Solaris machines on ER6. This must be fixed.

Comment 26 James Perkins 2013-05-03 15:23:33 UTC
The "./jboss-eap-6.1/bin/domain.sh: darwin: not found" issue is fixed, but I'm not sure what to do about the Solaris issue. I only have OpenSolaris 11 installed in a VM. I'm downloading OracleSolaris 10 now and I'll see if I can replicate the errors. We'll see if it works in VirtualBox.

My initial guess is that maybe "readlink -m" doesn't always return a value on Solaris 10.

Comment 29 Rostislav Svoboda 2013-05-03 17:21:00 UTC
Solaris 11 contains readlink command.
[hudson@dev21-01 ~]$ which readlink
/usr/bin/readlink

Solaris 10 does NOT contain readlink command.
Workaround is to use GNU coreutils - command greadlink, but we can't rely on tha fact it's installed on every Solaris 10 system.

[hudson@dev20-01 ~]$ which greadlink
/opt/csw/bin/greadlink


code from https://github.com/sstephenson/ruby-build/pull/9/files
resolve_link() {
  $(type -p greadlink readlink | head -1) $1
}
...
path="$(resolve_link "$name" || true)" 


Suggestion: For Solaris we should limit readlink invocation only to Solaris 11 and maybe document workaround for Solaris 10 - define JBOSS_LOG_DIR variable. This was needed for all Solaris and Windows platforms in EAP 6.0.0 and EAP 6.0.1.

Comment 30 Rostislav Svoboda 2013-05-03 17:30:46 UTC
Uname for Solaris 10:
---------------------
[hudson@dev20-01 ~]$ uname -a
SunOS dev20-01.mw.lab.eng.bos.redhat.com 5.10 Generic_142910-17 i86pc i386 i86pc
[hudson@dev20-01 ~]$ uname -v
Generic_142910-17
[hudson@dev20-01 ~]$ uname -r
5.10

Uname for Solaris 11:
---------------------
[hudson@dev21-01 ~]$ uname -a
SunOS dev21-01 5.11 11.0 i86pc i386 i86pc
[hudson@dev21-01 ~]$ uname -v
11.0
[hudson@dev21-01 ~]$ uname -r
5.11

Maybe code for darwin could be used for Solaris 10.

Comment 31 James Perkins 2013-05-03 17:32:53 UTC
I tried that it doesn't work either. It doesn't like the ${p#*=} bit. I'm trying to figure out how to handle that on Solaris 10 then we could test on Solaris 11.

Comment 32 Rostislav Svoboda 2013-05-03 17:38:44 UTC
OK, just reminder - if you won't find solution for Solaris 10, please limit readlink invocation only to Solaris 11 and Linux.

Comment 33 James Perkins 2013-05-03 21:54:24 UTC
Pull request updated with fix for Solaris in domain and standalone.

Comment 34 Dimitris Andreadis 2013-05-04 12:38:06 UTC
Thanks James.

Comment 35 Petr Kremensky 2013-05-10 08:48:30 UTC
Neither "darwin: not found" nor "bad substitution" message is thrown any more.

We also got rid of "Unable to read the logging configuration" messege (system variable is needed for Solaris machines, like in example from description). 

Verified on EAP 6.1.0 ER7.


Note You need to log in before you can comment on or make changes to this bug.