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

Clarify table that shows how logging properties are transferred to system properties #32160

Closed
fjakop opened this issue Aug 24, 2022 · 8 comments
Labels
type: documentation A documentation update
Milestone

Comments

@fjakop
Copy link

fjakop commented Aug 24, 2022

spring-boot 2.7.2

As stated in the docs at https://docs.spring.io/spring-boot/docs/2.7.2/reference/html/features.html#features.logging.file-rotation the log file rotates on a per day basis and when it reaches 10MB.

This is working fine when configured in application.yaml

logging:
  file:
    name: my/path/application.log

However this feature stops working when the log file is configured by the environment variable LOG_FILE

LOG_FILE=my/path/application.log

We would expect the same (rotation) behaviour in both cases since the environment variable is the yaml equivalent according to https://docs.spring.io/spring-boot/docs/2.7.2/reference/html/features.html#features.logging.custom-log-configuration.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 24, 2022
@quaff
Copy link
Contributor

quaff commented Aug 24, 2022

Are you missing _NAME suffix?

@snicoll
Copy link
Member

snicoll commented Aug 24, 2022

That looks like an oversight in the documentation to me. Can you try with LOG_FILE_NAME as @quaff suggests?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Aug 24, 2022
@philwebb
Copy link
Member

I think the documentation might be a little confusing in this area. The logging.file.name property is transferred to a system property named LOG_FILE so that it can be referenced in logging configuration files (e.g. logback.xml). You can find the code in the LogFile class.

It looks like the transfer happens regardless of any existing system property.

You could try setting a LOGGING_FILE_NAME environment variable. I think that will map to logging.file.name and then get transferred to LOG_FILE and be picked up by Logback/Log4j.

@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Aug 31, 2022
@fjakop
Copy link
Author

fjakop commented Sep 1, 2022

Thanks for the input, I verified the suggested solution using LOGGING_FILE_NAME, this works and is fine for me.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Sep 1, 2022
@wilkinsona
Copy link
Member

Let's see if we can clarify the documentation. The table shows how properties in the Spring environment are transferred to system properties but, judging by this issue, it's easy to misinterpret the "System Property" column as environment variables as they're in UPPER_CASE.

@wilkinsona wilkinsona changed the title Environment variable LOG_FILE causes log file rotation to stop working Clarify table that shows how logging properties are transferred to system properties Sep 1, 2022
@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Sep 1, 2022
@wilkinsona wilkinsona added this to the 2.6.x milestone Sep 1, 2022
@vivganes
Copy link
Contributor

vivganes commented Sep 6, 2022

I am willing to take this and work on it. Given that there is a confusion between System property and the Environment variables, would it be good if i add a column with title Environment variable and write the env variables that need to be set for each property in the table?

@wilkinsona
Copy link
Member

Thanks for the offer, @vivganes. I'm not really sure how best to fix this. Unfortunately, I don't think another column will help overall. Due to the limited width in the documentation, I think an extra column will make the table harder to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

7 participants