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

Fix log file path based on ORCHARD_APP_DATA environment variable #15364

Merged
merged 6 commits into from
Mar 8, 2024

Conversation

ns8482e
Copy link
Contributor

@ns8482e ns8482e commented Feb 19, 2024

set log location to ORCHARD_APP_DATA\logs to when ORCHARD_APP_DATA is set.
Fixes #15363

@@ -29,6 +29,7 @@
{
"Name": "File",
"Args": {
// Replace App_Data with %ORCHARD_APP_DATA% to change log file location to use environment variable.
"path": "App_Data/logs/orchard-log.txt",
Copy link
Member

Choose a reason for hiding this comment

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

Should we also change App_Data with %ORCHARD_APP_DATA%? Then in the comment, we can explain what %ORCHARD_APP_DATA% does

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did change - but then I reverted it - as in case of default when ORCHARD_APP_DATA is not defined, it would change the current behavior, and would create logs in ContentRoot\logs instead of ContentRoot\App_Data\logs

Copy link
Member

Choose a reason for hiding this comment

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

I think it is a very low risk breaking change that we can adapt. We should consider adding it and then document it in the 1.9 release as a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's in template affects only new sites that's created with dotnet new - IMO we should not change template with %ORCHARD_APP_DATA%

@MikeAlhayek MikeAlhayek merged commit 6aac96d into main Mar 8, 2024
5 checks passed
@MikeAlhayek MikeAlhayek deleted the ns/#15363 branch March 8, 2024 02:13
@hyzx86
Copy link
Contributor

hyzx86 commented Mar 11, 2024

It seems that this change would require tweaking existing config file,
This is because the old version of the NLog.config file will not log anything after updating the latest package

@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="App_Data/logs/internal-nlog.txt">
internalLogFile="${var:configDir}/logs/internal-nlog.txt">
Copy link

@snakefoot snakefoot Mar 11, 2024

Choose a reason for hiding this comment

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

Notice NLog InternalLogger is very basic, and internalLogFile="..." doesn't support parsing advanced layouts like ${var:configDir}. See also: https://github.com/NLog/NLog/wiki/Internal-Logging (Only support some basic tokens like ${basedir} or ${processdir})

@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="App_Data/logs/internal-nlog.txt">
internalLogFile="${var:configDir}/logs/internal-nlog.txt">
Copy link

@snakefoot snakefoot Mar 11, 2024

Choose a reason for hiding this comment

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

Notice NLog InternalLogger is very basic, and internalLogFile="..." doesn't support parsing advanced layouts like ${var:configDir}. See also: https://github.com/NLog/NLog/wiki/Internal-Logging (Only support some basic tokens like ${basedir} or ${processdir})

@MikeAlhayek
Copy link
Member

@ns8482e can you please revisit this PR?

@ns8482e
Copy link
Contributor Author

ns8482e commented Mar 17, 2024

@MikeAlhayek Thanks will look into

urbanit pushed a commit to urbanit/OrchardCore that referenced this pull request Mar 18, 2024
…hardCMS#15364)

---------

Co-authored-by: Mike Alhayek <mike@crestapps.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting environment variable doesn't change log location.
5 participants