feed-me icon indicating copy to clipboard operation
feed-me copied to clipboard

Having the possibility to set the log output folder

Open jan-dh opened this issue 1 year ago • 1 comments

Description

In a cloud/containerised env. you often don't have the option to store logs directly on the server. Right now the path to save login files is hardcoded in the plugin:

  public function init(): void
    {
        $this->logFile = Craft::$app->path->getLogPath() . '/feedme.log';
    }

Would love to have the ability to set this to an external service etc. or piggy back making the getLogPath() to be set as a config somewhere in Craft CMS.

jan-dh avatar Jul 04 '23 07:07 jan-dh

@jan-dh thanks for reporting!

This needs to be converted to use a real logger instead of explicitly logging to a file.

That will give you the opportunity to direct it wherever you like.

I'll work on getting this implemented, stay tuned!

timkelty avatar Jul 14 '23 15:07 timkelty

Similar question. We're using FeedMe in production for hourly imports from an ERP and I'm worried about those log files growing to epic sizes without manually deleting old logs…

markhuot avatar Jun 04 '24 13:06 markhuot

Thanks for the bump, @markhuot. Still on my radar!

timkelty avatar Jun 06 '24 20:06 timkelty

@jan-dh, @markhuot with https://github.com/craftcms/feed-me/pull/1462, I've converted the homegrown logging to a real Yii Log Target with a custom category.

With that PR, logs will be persisted to the database by default. Since it is a normal log target, if you want them as files, or anywhere, you can add a log target to you config/app.php and narrow it to categories: ['feed-me'].

Give it a spin with craftcms/feed-me:dev-feature/logs-as-log-targets as 5.6.0 and let me know how it works for you.

timkelty avatar Jun 11 '24 20:06 timkelty

Merged and will be included in the next Feed Me 5 and 6 releases.

angrybrad avatar Jun 12 '24 21:06 angrybrad