OpenLiberty / ci.maven

Maven plugins for managing Liberty profile servers #devops
Apache License 2.0
130 stars 91 forks source link

Changing the logging directory not possible #1224

Open BrentLeemans opened 3 years ago

BrentLeemans commented 3 years ago

Hello,

I have tried to change the logging directory (in the server.xml file). The plugin has not "seen" the server start.

It seems the Liberty plugin try to locate the "started message" in the default location.

This is an old issue but the problem still occurs: here

scottkurz commented 3 years ago

I just recreated this in 3.3.5-M2, on Windows.

I think we might have closed this before as a duplicate while fixing a partially-overlapping, similar problem, without fixing this problem. E.g. this fix: https://github.com/OpenLiberty/ci.maven/pull/253/files seems to fix the usecase when a WLP_OUTPUT_DIR is used in server.env but not a <logging logDirectory="C:\logs"... />

@BrentLeemans can you please mention what platform(s) you're using: Win/Mac/etc., and what version of liberty-maven-plugin (again, I don't think upgrading to the latest will resolve this) ? Thank you for opening the issue.

Stepping back and thinking out loud, this seems like a tricky problem to solve since we have to deal with the different config sources:

AND we also have to "merge" the general output dir setting with the more specific log dir setting when appropriate.

Maybe another point I'm making: I don't think we support the LOG_DIR in server.env either.

ANOTHER NOTE/QUESTION

I didn't realize this, maybe it is already documented..but.. is it always supposed to be the case that the env vars get loaded only from server.env and NOT from the process launching mvn ? I think that would be a good design.. just taking the opportunity to ask/confirm this is documented.

BrentLeemans commented 3 years ago

@scottkurz Thank you for taking the time to review my issue. I'm using Ubuntu 20.04.2 LTS and my liberty-maven-plugin version is 3.2.3.

ArkUmbra commented 1 year ago

Hello. I am curious if there has been any movement on this issue? Thank you

cherylking commented 1 year ago

Hello. I am curious if there has been any movement on this issue? Thank you

@ArkUmbra Hello, this issue has not been on our priority list so far.

cherylking commented 1 year ago

Wanted to make a few points here based on the Liberty documentation.

  1. Changing the location of the logs dynamically after startup using the <logging logDirectory=""/> attribute is not recommended. See the Avoid trouble: section in the attribute description.
  2. There are at least two different ways to affect the location of the logs that our plugin should support....first the WLP_OUTPUT_DIR can be set in the environment or the server.env...second the LOG_DIR can be set in the environment or the server.env. The LOG_DIR also has an equivalent com.ibm.ws.logging.log.directory property that could be specified in bootstrap.properties.
  3. The environment variables of the launching JVM are used if present, but the server.env takes precedence. This is documented here.

Note that I need to confirm that our plugin actually supports both ways to change the log location that I mentioned in point 2 above. I suspect we need some changes to support LOG_DIR and its equivalent property. If so, I will use this issue to track those changes.