-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment variable LOG_DIR not respected in server.xml #7461
Comments
Seems related to the doc issue I opened: OpenLiberty/docs#6391 |
Can this issue just be closed/cancelled, since we are are unsetting LOG_DIR on purpose? Working as Designed? Then document in OpenLiberty/docs#6391 that the LOG_DIR is unset by the server script and that if an application needs the value of LOG_DIR, they should save that in another variable in server.env. server script
|
It was decided to stop unsetting LOG_DIR. I found that we unset other variables as well:
These are documented here. The comment in the "server" script is this: Similar comment in Windows server.bat: Internally we reassign these variables to new variables with an "X_" prefixed to the variable names; eg. X_LOG_DIR. In the PR, I only removed the unset of the LOG_DIR variable, since that is all that was asked for. |
@msmigiel commented on Wed May 08 2019
I'm running Open Liberty 19.0.0.4 on Windows 10 and am seeing an odd issue.
In my server.xml, I have a section for logging as follows:
<logging hideMessage="SRVE9967W, CWWKO0221E" maxFileSize="64" consoleLogLevel="INFO" logDirectory="${env.LOG_DIR}" messageFileName="${env.MESSAGE_FILE}" traceFileName="${env.TRACE_FILE}" traceSpecification="" />
In my batch script to start Liberty, I define the variables as:
set LOG_DIR=%USER_HOME%\logs
set LOG_FILE=%JVM%_%COMPUTERNAME%_%CURRENT_DATE%.log
set MESSAGE_FILE=%JVM%_%COMPUTERNAME%_%CURRENT_DATE%.log
set TRACE_FILE=%JVM%_trace_%COMPUTERNAME%_%CURRENT_DATE%.log
I am not using a bootstrap.properties. When I start Liberty with the above, I see that a folder called "${env.LOG_DIR}" is created in my Liberty server's folder (usr\servers\defaultServer) and has the properly named message and trace files. The problem is that logDirectory is not using the variable I pass to it as a variable but rather a file name. As a workaround, if I add the following to my script:
set LOG_PATH=%LOG_DIR%
and change to the following in server.xml:
logDirectory="${env.LOG_PATH}"
it works. I can't figure out why LOG_DIR doesn't work but LOG_PATH does. According to what I've read, this is the proper way to use environment variables and LOG_DIR is one used by the Liberty script itself.
The text was updated successfully, but these errors were encountered: