Open betterapp opened 2 years ago
Is this an import or an export? Or on other words: Does the dataport have a target class or does it have target class Export
?
Background: Only object-specific logs will go to $params['logs']
. Object-independent logs like general information cannot be accessed via $params['logs']
but it can via $params['context']['logs']
.
Import 0bjects
but it worked in 2.8.*
And you see logs when you click Finished successfully
in the history panel?
In history panel - log file - Yes
but
$params['logs'] is empty
hmmm. now after rerun I see logs. strange.
Hi. The problem happend sometimes.
I have code like this:
if (!function_exists('ConverrLocalDumpTransfer')) {
function ConverrLocalDumpTransfer($transfer) {
if (empty($transfer)) {
return '';
}
$fullLog = 'ImportId: ' . $transfer->runId . "\n";
foreach ($transfer->logs as $log) {
$itemStart = $itemEnd = '';
if (isset($log['info'])) {
$itemStart = $log['info'][0] . "\n";
$itemEnd = end($log['info']) . "\n";
}
$warningText = '';
if (isset($log['warning'])) {
foreach ($log['warning'] as $warning) {
$warningText = $warningText . $warning . "\n";
}
}
$noticeText = '';
if (isset($log['notice'])) {
foreach ($log['notice'] as $notice) {
$noticeText = $noticeText . $notice . "\n";
}
}
$alertText = '';
if (isset($log['alert'])) {
foreach ($log['alert'] as $alert) {
$alertText = $alertText . $alert . "\n";
}
}
$errorText = '';
if (isset($log['error'])) {
foreach ($log['error'] as $error) {
$errorText = $errorText . $error . "\n";
}
}
$itemText = $itemStart . $errorText . $alertText . $warningText . $noticeText . $itemEnd;
$fullLog .= $itemText . "\n";
}
$fullLog .= 'Import DONE ';
$with = [];
if (!empty($errorText)) {
$with[] = 'errors';
}
if (!empty($alertText)) {
$with[] = 'alerts';
}
if (!empty($noticeText)) {
$with[] = 'notices';
}
if (!empty($warningText)) {
$with[] = 'warnings';
}
if (!empty($with)) {
$fullLog .= implode(', ', $with);
}
return $fullLog . "\n";
}
}
if (!isset($params['transfer']->runId)) {
$params['transfer']->runId = uniqid();
}
$params['transfer']->logs[] = $params['logs'];
if ($params['lastCall']) {
$supplierLog = ConverrLocalDumpTransfer($params['transfer']);
if (!empty($supplierLog)) {
$logFileName = $fileName . '-' . $params['transfer']->runId . '-import_log.txt';
$logFile = new \Pimcore\Model\Asset();
$logFile->setData($supplierLog);
$logFile->save();
}
}
And in some cases the log file is empty but for most 99% of imported files I have data in custom log.
In my case one file create such custom log file:
but orginal import log file have data:
Is it possible that in some cases $params['logs'] will be empty ?
any update ?
Under Result callback function I have code like this:
$params['transfer']->logs[] = $params['logs'];
if ($params['lastCall']) { var_dump($params['transfer']->logs); die; ..... }
Why $params['logs'] is empty ? We use 3.0.6 and in 2.8.6 it was not empty.