Debugging Omeka S
To configure Omeka S for a development server, you will need to make these changes / additions.
SetEnv APPLICATION_ENV "production"
SetEnv APPLICATION_ENV "development"
'logger' => [ 'log' => true, ],
Log messages are written to
To use internal assests, such as a local copy of jQuery, add this to
'assets' => [ 'use_externals' => false, ],
Logging within Controllers
Omeka S provides a
logger() plugin withing Controllers. This provides access to the Omeka S logging system. You can write messages to the log with, e.g.,
Omeka\Mvc\Controller\Plugin\Logger object uses methods from
Zend\Log\LoggerInterface, which makes it easy to give messages at different log levels:
Logging within Jobs
Jobs that run in the background do not have access to the
logger() plugin. Instead, you can get the logger from the ServiceManager anywhere inside the Job class:
$logger = $this->getServiceLocator()->get('Omeka\Logger');
Then use as above, e.g.
$logger()->info('Importing page 1')
Log messages are not written to
application.log from inside a Job. Instead, they are written to the Job's record. You can view the information by look at the Job record in the admin screen.
Logging within Views
If you need to do some debugging work elsewhere, such as within an Entity, you need to inject the Logger via a factory for the object. See Services and Factories for details.
__invoke() method of your factory, add
$logger = $serviceLocator->get('Omeka\Logger');
and add it as a property for your class.