How to avoid deprecated messages in the logs?

Last modified by Thomas Mortagne on 2020/03/18

You may be seeing a lot of messages such as:

2013-07-24 10:38:45,085 [http://docstestsite.myxwiki.org/xwiki/bin/register/XWiki/Register] WARN  o.x.v.i.DefaultVelocityEngine  - Deprecated usage of method [com.xpn.xwiki.web.XWikiMessageTool.get] in docstestsite:Panels.Search@2,25

There are 2 solutions to remove them

  • Solution 1: Fix deprecation usages.
  • Solution 2: Configure XWiki to not log deprecated calls. You do this by editing your WEB-INF/xwiki.properties file.
    • For XWiki 12+: You can set the property logging.deprecated.enabled to false to generally disabledd any deprecated API related log
    • For XWiki 8.0M1+: You need to uncomment the line that starts with velocity.properties = runtime.introspector.uberspect =[...]. Then after the last equal sign, remove the org.xwiki.velocity.introspection.DeprecatedCheckUberspector\, part, leaving the other Uberspectors.
    • For XWiki 5.2M1+: You need to uncomment the line that starts with velocity.properties = runtime.introspector.uberspect.chainClasses =[...]. Then after the last equal sign, remove the org.xwiki.velocity.introspection.DeprecatedCheckUberspector\, part, leaving the other Uberspectors.
    • For older XWiki versions: You'll need to make sure that each uberspector is separated from the next one by \, and not just by , which won't work. This is because for XWiki < 5.2M1 we had a mistake in the comment in xwiki.properties for this property and we fixed it in 5.2M1.

Fixing Deprecation Usage Examples

One typical occurrence is when there's the following in Velocity code:

$msg.get(...

It should be changed to either:

$services.localization.render(...

or even better use the Translation Macro whenever possible.

Tags:
Created by Vincent Massol on 2013/07/24
   

Get Connected