chocolatey / chocolatey/choco

log4net:WARN Cannot RollFile

Open
#2,310 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### What You Are Seeing?

```
ERROR: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: log4net:WARN Cannot RollFile [C:\ProgramData\chocolatey\logs\choco.summary.1.log] -> [C:\ProgramData\chocolatey\logs\choco.summary.2.log]. Source does not exist
at , C:\ProgramData\chocolatey\lib\deployment\tools\lib\choco.ps1: line 74
at Upgrade-ChocoPackages, C:\ProgramData\chocolatey\lib\deployment\tools\lib\choco.ps1: line 70
at , C:\ProgramData\chocolatey\lib\deployment\tools\chocolateyinstall.ps1: line 68
at , C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1: line 49
at , : line 1
2020-08-03 11:44:58,267 5076 [WARN ] -
Chocolatey upgraded 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2020-08-03 11:44:58,267 5076 [INFO ] -
2020-08-03 11:44:58,267 5076 [ERROR] - Failures
2020-08-03 11:44:58,267 5076 [ERROR] - - deployment (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\deployment\tools\chocolateyinstall.ps1'.
```

### What is Expected?
No error, Log4NET should find the file and continue logging.

### How Did You Get This To Happen? (Steps to Reproduce)
Deployment script to install a lot of software and do db migration that's a lot of log information, over 20MB.

### Output Log

Full Log Output

~~~sh
2020-08-03 11:42:46,781 5076 [DEBUG] - XmlConfiguration is now operational
2020-08-03 11:42:46,875 5076 [INFO ] - ============================================================
2020-08-03 11:42:47,172 5076 [INFO ] - Chocolatey v0.10.15
2020-08-03 11:42:47,187 5076 [DEBUG] - Chocolatey is running on Windows v 6.3.9600.0
...

2020-08-03 11:47:25,986 1300 [WARN ] -
Chocolatey upgraded 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2020-08-03 11:47:25,986 1300 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2020-08-03 11:47:25,986 1300 [DEBUG] - Exiting with 0
~~~

Issue is knows for Log4NET for years https://issues.apache.org/jira/browse/LOG4NET-82

Is it possible to override the log file size? It is set to 1024*1024*10 in code. https://github.com/chocolatey/choco/blob/af3e8c9577ed29d7572581418a8274fd6ce7709b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs#L230

Contributor guide

Open the contributing guide

Research direction

Start with src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs around line 230, then review the deployment script and log output to understand the rolling-file failure when logs exceed 10 MB. Reproduce the reported upgrade scenario and verify that the configured log file is found and logging continues without the Cannot RollFile warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.