Skip to content
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

log file with a different instance root directory #10373

Merged
merged 7 commits into from
Mar 26, 2024

Conversation

BenediktMeierUIT
Copy link
Contributor

What this PR does / why we need it:
log file with a different instance root directory
Which issue(s) this PR closes:
Closes #10372

Special notes for your reviewer:

Suggestions on how to test this:

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

@BenediktMeierUIT BenediktMeierUIT changed the title Develop log file with a different instance root directory Mar 13, 2024
@pdurbin
Copy link
Member

pdurbin commented Mar 13, 2024

@BenediktMeierUIT thanks for the pull request. Out of curiosity, what is your instance root?

@pdurbin pdurbin added the Size: 3 A percentage of a sprint. 2.1 hours. label Mar 13, 2024
@Louis-wr
Copy link
Contributor

@BenediktMeierUIT thanks for the pull request. Out of curiosity, what is your instance root?

Benedikt as been working with us on dataverse.no

@pdurbin
Copy link
Member

pdurbin commented Mar 13, 2024

Cool. I'm still wondering what you use as an instance root, but no rush. 😄 Oh! Maybe you're using Docker? 🤔

We recently make a similar change at 8efb964 and as discussed in Slack, we know there are more places to fix, as you've done. Thanks!

@BenediktMeierUIT
Copy link
Contributor Author

Yes, this is a Docker.
And I solved the errors straight away.
8efb964

I'm not quite sure about another point. Why it was done differently.

String logDir = System.getProperty("com.sun.aas.instanceRoot") + SEP + "logs" + SEP + "edit-drafts" + SEP;

String logDir = System.getProperty("com.sun.aas.instanceRoot") + SEP + "logs" + SEP + "process-failures" + SEP;

(I don't have access to Slack :-( )

@pdurbin
Copy link
Member

pdurbin commented Mar 13, 2024

Sorry, can you please spell out a little more how it's done differently? From a quick look it seems more or less the same to me.

@BenediktMeierUIT
Copy link
Contributor Author

Sorry...
It's the same, but it's inconsistent.
My question was/is, what is the guideline and how do you want it?

@BenediktMeierUIT
Copy link
Contributor Author

At that point, it's done differently again:

public static final String DATAVERSE_HARVEST_STOP_FILE="../logs/stopharvest_";

I was going to change the line like this:
public static final String DATAVERSE_HARVEST_STOP_FILE="stopharvest_";
and in the place:
String stopFileName = DATAVERSE_HARVEST_STOP_FILE + harvestingClient.getName() + "." + pid;

String stopFileName = System.getProperty("com.sun.aas.instanceRoot") + File.separator + "logs" + File.separator + DATAVERSE_HARVEST_STOP_FILE + harvestingClient.getName() + "." + pid;

@poikilotherm
Copy link
Contributor

poikilotherm commented Mar 13, 2024

This should be a JVM option defaulting to the system property as well as made consistent everywhere.

@pdurbin
Copy link
Member

pdurbin commented Mar 14, 2024

It's funny, just today I was in DatasetServiceBean.java debugging something and I copied the fix from this PR because I'm in Docker and was hitting a problem without it.

I'd say we definitely want this fix.

And yes, a JVM option/MicroProfile Config setting eventually. In this PR or later.

@pdurbin pdurbin added the Component: Containers Anything related to cloudy Dataverse, shipped in containers. label Mar 14, 2024
@Louis-wr
Copy link
Contributor

Yes, A JVM option/MicroProfile Config would be nice in the future but for now we should avoid overreaching this pull request and keep it confine to the bug fix that it is.
In the near future once this is fixed it will be easy to replace all the System.getProperty("com.sun.aas.instanceRoot") with the appropriate newly created JVM option/MicroProfile Config.

@pdurbin
Copy link
Member

pdurbin commented Mar 14, 2024

Yes, sounds good to defer adding a JVM/MPConfig option until later.

BenediktMeierUIT added a commit to DataverseNO/dataverse that referenced this pull request Mar 19, 2024
@poikilotherm
Copy link
Contributor

Adding the option is almost a one liner. Do you want me to create a small PR to this PR with it? @pdurbin if you leave a review after, I can do QA and we ship this one fast.

@BenediktMeierUIT
Copy link
Contributor Author

If you give me the JVM/MPConfig name, I can change the format to what you want.

@pdurbin
Copy link
Member

pdurbin commented Mar 20, 2024

Sure, I'm happy to do a review and let @poikilotherm do the QA.

String logFileName = "../logs" + File.separator + "export_" + logTimestamp + ".log";
String logFileName = System.getProperty("com.sun.aas.instanceRoot") + File.separator + "logs" + File.separator + "export_" + logTimestamp + ".log";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can vouch for the need for this change. Without it, I couldn't get some code I was playing with to execute. I was exporting some JSON for troubleshooting: pdurbin@8adb28d

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like within a container, the application has a different working directory than in a classic deployment. Which means ../logs may point to some place that does not exist / the app user has no permissions to write to.

Copy link
Contributor

@poikilotherm poikilotherm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the explanation via DM and in https://github.com/IQSS/dataverse/pull/10373/files#r1535665937, I understood better why this change is necessary.

As we should be thorough with this change, can you fix the missing occurrences @BenediktMeierUIT ?

Those would be in dataverse.authorization.AuthFilter and dataverse.harvest.client.HarvesterServiceBean.

@coveralls
Copy link

coveralls commented Mar 22, 2024

Coverage Status

coverage: 20.659%. remained the same
when pulling a2c50b6 on DataverseNO:develop
into 30666f9 on IQSS:develop.

BenediktMeierUIT added a commit to DataverseNO/dataverse that referenced this pull request Mar 25, 2024
@BenediktMeierUIT
Copy link
Contributor Author

That's right...
I have changed it.

BenediktMeierUIT added a commit to DataverseNO/dataverse that referenced this pull request Mar 25, 2024
Copy link
Contributor

@poikilotherm poikilotherm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thanks for the change! @pdurbin stage is yours 😄

@pdurbin
Copy link
Member

pdurbin commented Mar 26, 2024

@BenediktMeierUIT for next time, please do not use "develop" as the name of your branch. It make it hard to review and test as described in this issue:

@pdurbin
Copy link
Member

pdurbin commented Mar 26, 2024

Tests are passing as as I mentioned above these changes are very similar to changes I made in pdurbin@8adb28d

Merging.

@pdurbin pdurbin merged commit d14e18a into IQSS:develop Mar 26, 2024
11 checks passed
@pdurbin pdurbin added this to the 6.2 milestone Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Containers Anything related to cloudy Dataverse, shipped in containers. Size: 3 A percentage of a sprint. 2.1 hours.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

log file with a different instance root directory
5 participants