Error in processing log files

I am running OJS 2.4.6 on Postgres, recently migrated from a 2.4.1

I’ve migrated the statistics to the new metrics and the system seems to correctly log views but I get an error in log processing.

When I run

php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml

I find this error that I can not understand where exactly came from:

ojs@ojsfe01:/production/var/leo$ php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml
<h1>DB Error: ERROR:  invalid input syntax for integer: "Special issue: IX ATIt Congress"</h1>ojs2: DB Error: ERROR:  invalid input syntax for integer: "Special issue: IX ATIt Congress"


What happened?


Hi @marchitelli,

Could you try turning on the show_stacktrace setting in and triggering the error again? This will capture more information that can help debug.

Alec Smecher
Public Knowledge Project Team

Hi @asmecher, this is the stack trace

ojs@ojs:/production/var/ojs01$ php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml
<h1>DB Error: ERROR:  invalid input syntax for integer: "Special issue: IX ATIt Congress"</h1><h4>Stack Trace:</h4>
<strong>File:</strong> /production/var/ojs01/classes/issue/ line 64<br />
<strong>Function:</strong> DAO->retrieve("SELECT i.* FROM issues i WHERE issue_id = ?", "Special issue: IX ATIt Congress")<br />
<strong>File:</strong> /production/var/ojs01/classes/issue/ line 26<br />
<strong>Function:</strong> IssueDAO->getIssueById("Special issue: IX ATIt Congress", Null, False)<br />
<strong>File:</strong> (unknown) line (unknown)<br />
<strong>Function:</strong> IssueDAO->_cacheMiss(Object(GenericCache), "Special issue: IX ATIt Congress")<br />
<strong>File:</strong> /production/var/ojs01/lib/pkp/classes/cache/ line 63<br />
<strong>Function:</strong> call_user_func_array(Array(2), Array(2))<br />
<strong>File:</strong> /production/var/ojs01/classes/issue/ line 91<br />
<strong>Function:</strong> GenericCache->get("Special issue: IX ATIt Congress")<br />
<strong>File:</strong> /production/var/ojs01/classes/issue/ line 182<br />
<strong>Function:</strong> IssueDAO->getIssueByPubId("publisher-id", "Special issue: IX ATIt Congress", "3", True)<br />
<strong>File:</strong> /production/var/ojs01/plugins/generic/usageStats/ line 576<br />
<strong>Function:</strong> IssueDAO->getIssueByBestIssueId("Special issue: IX ATIt Congress", "3", True)<br />
<strong>File:</strong> /production/var/ojs01/plugins/generic/usageStats/ line 519<br />
<strong>Function:</strong> UsageStatsLoader->_getInternalIssueId("Special issue: IX ATIt Congress", Object(Journal))<br />
<strong>File:</strong> /production/var/ojs01/plugins/generic/usageStats/ line 181<br />
<strong>Function:</strong> UsageStatsLoader->_getAssocFromUrl(" is...", "/production/var/ojs-uploads/ojs01/usageStats/processing/usage_even...", 434)<br />
<strong>File:</strong> /production/var/ojs01/lib/pkp/classes/task/ line 131<br />
<strong>Function:</strong> UsageStatsLoader->processFile("/production/var/ojs-uploads/ojs01/usageStats/processing/usage_even...", Null)<br />
<strong>File:</strong> /production/var/ojs01/plugins/generic/usageStats/ line 124<br />
<strong>Function:</strong> FileLoader->executeActions()<br />
<strong>File:</strong> /production/var/ojs01/lib/pkp/classes/scheduledTask/ line 149<br />
<strong>Function:</strong> UsageStatsLoader->executeActions()<br />
<strong>File:</strong> /production/var/ojs01/lib/pkp/classes/cliTool/ line 112<br />
<strong>Function:</strong> ScheduledTask->execute()<br />
<strong>File:</strong> /production/var/ojs01/lib/pkp/classes/cliTool/ line 95<br />
<strong>Function:</strong> ScheduledTaskTool->executeTask("plugins.generic.usageStats.UsageStatsLoader", Array(0))<br />
<strong>File:</strong> /production/var/ojs01/lib/pkp/classes/cliTool/ line 66<br />
<strong>Function:</strong> ScheduledTaskTool->parseTasks("plugins/generic/usageStats/scheduledTasks.xml")<br />
<strong>File:</strong> /production/var/ojs01/tools/runScheduledTasks.php line 34<br />
<strong>Function:</strong> ScheduledTaskTool->execute()<br />
ojs2: DB Error: ERROR:  invalid input syntax for integer: "Special issue: IX ATIt Congress"


Hi @marchitelli,

Thanks, that helps. Could you try the patch at Add missing int casts to IssueDAO · Issue #578 · pkp/pkp-lib · GitHub to see if it corrects the issue? If you can confirm, I’ll commit it for release in OJS 2.4.6-1.

Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
the patch causes a blank pages in every pages beyond login. This is the error log

[Mon Jul 06 21:50:23 2015] [error] [client] ojs2 has produced an error\n  Message: WARNING: Cannot modify header information - headers already sent by (output started at /var/ojs/classes/issue/\n  In file: /var/ojs/lib/pkp/classes/core/\n  At line: 87\n  Stacktrace: \n  Server info:\n   OS: Linux\n   PHP Version: 5.4.39-0+deb7u2\n   Apache Version: Apache/2.2.22 (Debian)\n   DB Driver: postgres\n   DB server version: PostgreSQL 9.1.12 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.7.2-5) 4.7.2, 64-bit

I tried to bypass the error (run the process with the patch and see the results without the patch
I saw that all files were processed (now they are /ojs-uploads/leo/usageStats/archive directory) but the report (e.g. OJS usage statistics report at ) are without any data.


Hi @marchitelli,

I don’t think the patch applied successfully. Did you apply it using the patch tool, or manually? If with the patch tool, what was its output?

Alec Smecher
Public Knowledge Project Team

You are right, @asmecher: I’ve reversed and re-applied the patch and now the import process works :blush:

Otherwise, the report downloaded from User > Journal Management > Stats & Reports > OJS usage statistics report is blank and contains no data.


Hi @marchitelli,

I suspect you also have to patch this and then re-run your logs: Stats can't process Issues with unique identifiers · Issue #460 · pkp/pkp-lib · GitHub

Alec Smecher
Public Knowledge Project Team

HI @asmecher,
I have applied Stats can't process Issues with unique identifiers · Issue #460 · pkp/pkp-lib · GitHub and re-run logs processing.

My usage stat reposrt is still blank.

Moreover, I fond that in the new COUNTER report (the one generated with new usagestats plugin) I have data only for some journals. Other journals are not listed at all.

I don’t know if this can help

For the missing data, have you confirmed that your base_url(s) from match what is being captured in your old Apache log files? See: My published file views or statistics reports shows no data. What do I do?

Hi @ctgraham,
I find the problem (thank you for pointing out the base_url setting)

In my installation I have several journals: some with custom urls and some with the url of the site index

In my I added baseurl overrides olny for journals with custom urls and I didn’t find data for a journal in the site index path (, below you can see the whole configuration)

Now I’ve added an override for jlis, too and re-processed the logs, so I now can see data for this journal, too.

It seems a strange behavior, for me, because I thought that overrides was only for custom urls.

Is my reasongin correct?


; Base URL override settings: Entries like the following examples can
; be used to override the base URLs used by OJS. If you want to use a
; proxy to rewrite URLs to OJS, configure your proxy’s URL here.
; Syntax: base_url[journal_path] =
; To override URLs that aren’t part of a particular journal, use a
; journal_path of “index”.
; Examples:
; base_url[index] =
; base_url[myJournal] =
; base_url[myOtherJournal] =
base_url[index] =
base_url[agcm] =
base_url[cilea] =
base_url[caspur] =
base_url[ccp] =
base_url[ebph] =
base_url[formez] =
base_url[hystrix] =
base_url[researchhpc2006] =
base_url[ijph] =
base_url[jlis] = LEO
base_url[symphonya] =
base_url[scires-it] =

What is your unqualified base_url from (without the [])?

This one, at the top of the file?

; The canonical URL to the OJS installation (excluding the trailing slash)
base_url = ""

Yes, with that configuration of base_url = and overrides for anything not hanging off of, I wouldn’t have expected a problem.

In adding the base_url[index] line, I personally would have entered:
base_url[index] = http://
but I don’t have an exactly parallel installation to use as a test for comparison, and your config might be correct.

But I had no data only for

base_url[jlis] = 

that is the same path of the index.

Now I am trying with another installation, where I have
base_url = “
base_url[index] =
base_url[interfaces] =
but a lot of other journal with standard urls

In this case, too, I find the data only for interfaces journal and no data for all other journals.
It seems to me a bit complicated to explicitly add in overrides all the journal if only one needs to have a custom url.

Can you semplify this in some way?

What do you mean by “a lot of other journals with standard URLs”? Are they of the form: ?

Hi @asmecher,
the patch Add missing int casts to IssueDAO · Issue #578 · pkp/pkp-lib · GitHub is ok, you can commit it, thanks!

I catched the problem of my reports thanks to @ctgraham, it seems related to base_url overrides (see below)

Yes, e.g.
I can’t get statistics for this journal but I can get data for (that is set up as an override):

base_url[index] = 
base_url[interfaces] =

I can try to add an override for DoctorVirtualis and reload logs, if you think that can help to confirm the issue.

What is your restful_urls value? You seem to be mixing restful urls ( and urls with the index.php component ( I bet that is confusing the Usage Stats process, but you are able to override the confusion by manually entering base_urls with the index.php component.

restful_urls = Off

It seems that the plugin is confused when at least one base_url override is present.
That one is the only one with stats running.

If I put only one override, I have to manage override for all journals