Issue
-
"JSONArray text must start with" DEBUG message are written to the logs when some Liferay Forms operations are carried out.
2023-09-14 11:34:05.180 DEBUG [http-nio-8080-exec-40][DDMFormFieldOptionsFactoryImpl:214] null
com.liferay.portal.kernel.json.JSONException: org.json.JSONException: A JSONArray text must start with '[' at 1 [character 2 line 1]
at com.liferay.portal.json.JSONArrayImpl.<init>(JSONArrayImpl.java:61) ~[portal-impl.jar:?]
at com.liferay.portal.json.JSONFactoryImpl.createJSONArray(JSONFactoryImpl.java:154) ~[portal-impl.jar:?]
...
-
This happens on our dev environment sometimes with 100s of the messages written, eg see the attached example.
- The messages don’t seem to cause anything to not work in Forms, but they do seem to slow down operations, eg “View entries” takes a long time. And they also make the logs difficult to work with.
Environment
- 7.4
Resolution
- Root cause is unsure, however, these debug messages most probably are logged because the DEBUG log level is enabled for the com.liferay.dynamic.data.mapping.form.field.type.internal.DDMFormFieldOptionsFactoryImpl category (see https://learn.liferay.com/web/guest/w/dxp/system-administration/using-the-server-administration-panel/configuring-logging)
-
You might have a file like this:
<liferay_home>/liferay/osgi/log4j/com.liferay.dynamic.data.mapping.form.field.type-log4j-ext.xml
which contains something like this:
<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<category name="com.liferay.dynamic.data.mapping.form.field.type.internal.DDMFormFieldOptionsFactoryImpl">
<priority value="DEBUG" />
</category>
</log4j:configuration>
By changing DEBUG to INFO, you should be able to get rid of these messages (even across server restarts).