choco icon indicating copy to clipboard operation
choco copied to clipboard

Allow logging to be controlled through `config` command

Open ferventcoder opened this issue 9 years ago • 9 comments

As a continuation of #852, allow changing the default sizes and number of files through configuration settings in choco. This was pushed as configurations is not available when setting up logging, so they would need to be adjusted as soon as the configuration is available.

This was originally requested by @DarwinJS

ferventcoder avatar Aug 03 '16 04:08 ferventcoder

I'm assuming you thinking the config would be set via the chocolatey.config or 'choco config'. Is there any specific format with in the file? It would seem the only attribute we are talking about is MBs per file and number of files, correct?

criter avatar Oct 09 '16 16:10 criter

@criter That sounds about right.

ferventcoder avatar Oct 09 '16 22:10 ferventcoder

Looking into this further, we have a chicken and egg problem. The log is configured before the SimpleInjectorContainer is configured.

            Log4NetAppenderConfiguration.configure(loggingLocation);
            Bootstrap.initialize();
            Bootstrap.startup();
            var license = License.validate_license();
            var container = SimpleInjectorContainer.Container;

            var config = container.GetInstance<ChocolateyConfiguration>();

So there seems to be a few options.

  1. Move the container creation above the log, seems like it would be a problem since there are likely constructors in there that might need to log.
  2. When configuring the log, read the config file directly without the ChocolateyConfiguration class, not good since repeating code.
  3. Instantiate the ChocolateyConfigSettingsService without using the container, then this would leave 2 different ChocolateyConfigSettngsService objects.

Likely some others that I'm not thinking about...

Thoughts?

criter avatar Oct 11 '16 04:10 criter

@criter that's why I moved this out to its own issue, you are touching on what I was seeing and I didn't have a way to deal with it set up just yet. Definitely something to revisit.

ferventcoder avatar Oct 11 '16 22:10 ferventcoder

:-) Just wanted to make sure I didn't reinvent the wheel if you already had an idea. Let me think about it and see what might make sense and run it by you.

criter avatar Oct 11 '16 22:10 criter

I believe logging configuration can be adjusted at any time.

ferventcoder avatar Oct 12 '16 04:10 ferventcoder

So it may just be an additional call or set of calls to make the log file size adjustments, etc.

ferventcoder avatar Oct 12 '16 04:10 ferventcoder

~~Related to #1453~~ (turned out to be invalid)

ferventcoder avatar Nov 14 '17 18:11 ferventcoder

@mrhockeymonkey I think you might be interested in watching this issue.

ferventcoder avatar May 02 '18 13:05 ferventcoder