Announcement

Collapse
No announcement yet.

Log statements not being sent to log file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Log statements not being sent to log file

    Using: EspoCRM Version 6.1.7

    I created a hook as follows:

    Code:
    1 <?php
    2
    3 namespace Espo\Custom\Hooks\TimesheetData;
    4
    5 use \Espo\Core\Exceptions\Error;
    6 use Espo\ORM\Entity;
    7
    8 class SaveTimesheetData extends \Espo\Core\Hooks\Base
    9 {
    10 public function beforeSave(Entity $en, array $options = array()) {
    11
    12 $GLOBALS['log']->debug('Got here');
    13 throw new Error("error");
    14
    The config file is set as follows:

    Code:
     41 'logger' => [
    42 'path' => 'data/logs/espo.log',
    43 'level' => 'DEBUG',
    44 'rotation' => true,
    45 'maxFileNumber' => 30
    46 ],
    I see debug statements in the log file from the application, but nothing from the hook appears in the log file. The "error" statements appears in the GUI when I try to save a new TimesheetData entity, which means the hook is being called as expected. I've tried debug, notice, info, and error; nothing has worked.

    I ran 'chown -R www-data:www-data custom/' to set every file to have the same permissions as the webserver user. Unfortunately, that didn't work either.

    Why are the log statements not appearing in the log file?
    Last edited by bandtank; 07-14-2021, 08:28 PM.

  • #2
    Update: I ran 'chown -R ubuntu:www-data .', which fixed the issue. Apparently, my webserver user is running with the same permissions as the default user (ubuntu). I'm not sure if I should fix that, but the logging issue is solved at least.

    Comment


    • #3
      Yeah, in such cases always have to check permissions. I had yesterday the same issue on one of instances

      Comment


      • #4
        Originally posted by emillod View Post
        Yeah, in such cases always have to check permissions. I had yesterday the same issue on one of instances
        Do you know how the permissions are set on the log files? I can't figure out how one of my instances has log files with 0664 and the other has log files with 0644. None of the configuration settings I've found have an effect on the permissions of the log files.

        Comment

        Working...
        X