OJS statistics views are 0

Hi there,

I’m having issues with the generated reports in the statistics section of OJS .

The view report contains the articles and issues, however the view counters are all set to 0.
The metrics SQL table doesn’t contain any rows.

Is this due to something missing in the configuration or a bug?

Thanks in advance for your assistance.


Hi @manue1

Do you use a fresh OJS 3.0.2 installation or was that an upgrade from OJS 2.4.x?
Are you using the generic Usage Statistics plugin? Those reports are based on that plugin, that logs, calculates and saves the statistics in the DB table metrics. More posts about that plugin you can find in this forum.


Hi @bozana,

it’s a fresh OJS 3.0.2 installation.

Yes, I am using the Usage Statistics plugin. I have tried disabling and enabling it again.
Due to your hint I did a search through the forum and found out that the issue might be a missing cron job.

The log files in the /usageStats/usageEventLogs do exist.

When running the cron job
php tools/runScheduledTasks.php lib/pkp/plugins/generic/usageStats/scheduledTasks.xml I receive the error:
Couldn't lock the file

Can you confirm if the missing cron job is what’s causing the metrics table to be empty? And if there’s a workaround for my error? I suppose it’s because the log file from the current day is still being written to by OJS?!


Hi @manue1

The error you get means that the scheduled task could not write its results in the scheduled task log file. Do you have scheduledTaskLogs/ folder in your files_dir? – the scheduled tasks will create the log files there, every time they are run.

Also please double check the access permissions on both folders usageStats/ and scheduledTaskLogs/ (and their contents).

One more thing that you could try:
Use this command to run that usage statistics scheduled task:
php tools/runScheduledTasks.php lib/pkp/plugins/generic/usageStats/scheduledTasksAutoStage.xml
move all older log files (except the current, from the current day) to the folder usageStats/stage/ and then run the command you have used:
php tools/runScheduledTasks.php lib/pkp/plugins/generic/usageStats/scheduledTasks.xml

If you use AconPlugin you do not need to create a cron job on your server.