Skip to content

Incorrect datetime persisted in the database log records #67

@jpgrandgirard

Description

@jpgrandgirard

The datetime persited in the database log records reflect the persitence date instead of the effective log creation

It seams that the createdAt should come from $record :

public function __construct(
\Monolog\LogRecord $record,
#[ORM\ManyToOne(targetEntity: ProcessExecution::class, cascade: ['all'])]
#[ORM\JoinColumn(name: 'process_execution_id', referencedColumnName: 'id', onDelete: 'CASCADE', nullable: false)]
private readonly ProcessExecution $processExecution,
) {
$this->channel = (string) (new UnicodeString($record->channel))->truncate(64);
$this->level = $record->level->value;
$this->message = (string) (new UnicodeString($record->message))->truncate(512);
$this->context = $record->context;
$this->createdAt = \DateTimeImmutable::createFromMutable(new \DateTime());
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions