Skip to content
This repository has been archived by the owner on Apr 30, 2023. It is now read-only.

Update LogOrganization.php #97

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Helper/LogOrganization.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static function organizeLogs() {
$arrayOfFiles = array("var/log/debug.log", "var/log/cron.log", "var/log/magento.cron.log", "var/log/system.log");
$countCrit = 0;

$fp = null;
foreach($arrayOfFiles as $value) {
if (!file_exists($value)) {
continue;
Expand Down Expand Up @@ -71,7 +72,9 @@ public static function organizeLogs() {

$countCrit = 0;
}
fclose($fp);
if ($fp !== null) {
manuelcanepa marked this conversation as resolved.
Show resolved Hide resolved
fclose($fp);
}

$amuLogs = self::tailCustom("var/log/facebook-business-extension.log", 100);
$amuLogsArr = explode("\n", $amuLogs);
Expand All @@ -88,7 +91,7 @@ public static function organizeLogs() {
}

public static function tailCustom($filepath, $lines) {
$f = fopen($filepath, "rb");
$f = fopen(BP . '/' . $filepath, "rb");
if ($f === false) {
return false;
}
Expand Down