3

In the latest awesome pattern we can now locate our log service easily:

Civi::log()->info('Hello, log!');

And then we can tail the log which is in our ConfigAndLog directory. Chris has enumerated the other log files around and Jon has described where to find the directory in different CMS's but I need to have a one liner to point me directly at the current log file.

For me, right this second, it is:

/opt/buildkit/build/dmaster/sites/default/files/civicrm/ConfigAndLog/CiviCRM.e6449e3815b7721f267195e2.log

How do I find this next time without having to go hunting around? Ideally I'm after a cv based one-liner.

1

Found it!

The log file is named by CRM_Exception::generateLogFileName($prefix); in civicrm/CRM/Core/Error.php.

  • I tried to make this into a cv command and failed. I got as far as ` cv ev "CRM_Exception::createDebugLogger(); return \Civi::$statics['CRM_Core_Error']['logger_file'];"` but alas it just returned false :-/ – ErichBSchulz Mar 1 '17 at 6:41
0

Based on your comment,

cv ev 'CRM_Core_Error::createDebugLogger(); return \Civi::$statics['CRM_Core_Error']['logger_file'];'
  • Might run into trouble with bash treating the square brackets as wildcards when using double quotes as above?
  • CRM_Core_Error not CRM_Exception worked for me.

Not sure what you're using this for, but an easier path might be to use wildcards. When developing I tend to just

tail -f sites/*/files/civicrm/ConfigAndLog/*log

and similar when collecting logfiles to some central service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.