Uploaded image for project: 'Mobile App'
  1. Mobile App
  2. MOBILEAPP-51

A lot of feed notifications are not sent to registered users

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 1.5.0
    • 1.4.0
    • None
    • None
    • 4.6 M5

      We activate logs for notifications.

      <?xml version="1.0" encoding="UTF-8"?>
      <!--
         Copyright 2010 Anyware Services
      
         Licensed under the Apache License, Version 2.0 (the "License");
         you may not use this file except in compliance with the License.
         You may obtain a copy of the License at
      
             http://www.apache.org/licenses/LICENSE-2.0
      
         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
         -->
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
      
          <appender name="servlet" class="org.apache.log4j.rolling.RollingFileAppender">
              <param name="Encoding" value="UTF-8" />
              <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
                <param name="FileNamePattern" value="${ametys.home.dir}/logs/ametys-cms-%d.log"/>
              </rollingPolicy>
              <layout class="org.apache.log4j.PatternLayout"> 
                  <param name="ConversionPattern" value="%d %-5p [%c] (%t;%X{requestURI}) %m%n"/> 
              </layout>
              <filter class="org.ametys.core.util.AmetysExceptionFilter"/>
          </appender>
          
          <appender name="migration" class="org.apache.log4j.rolling.RollingFileAppender">
              <param name="Encoding" value="UTF-8" />
              <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
                <param name="FileNamePattern" value="${ametys.home.dir}/logs/migration-%d.log"/>
              </rollingPolicy>
              <layout class="org.apache.log4j.PatternLayout"> 
                  <param name="ConversionPattern" value="%d %-5p [%c] (%t;%X{requestURI}) %m%n"/> 
              </layout>
              <filter class="org.ametys.core.util.AmetysExceptionFilter"/>
          </appender>
          
          <appender name="notifications" class="org.apache.log4j.rolling.RollingFileAppender">
              <param name="Encoding" value="UTF-8"/>
              <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
                  <param name="FileNamePattern" value="${ametys.home.dir}/logs/notifications-%d.log"/>
              </rollingPolicy>
              <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern" value="%d %-5p [%c] (%t;%X{requestURI}) %m%n"/>
              </layout>
              <filter class="org.ametys.core.util.AmetysExceptionFilter"/>
          </appender>
          
          <category name="org.ametys.core.migration.MigrationExtensionPoint"  additivity="false">
              <priority value="info"/>
              <appender-ref ref="migration"/>
          </category>
          
          <category name="org.ametys.plugins.mobileapp.PushNotificationManager" additivity="false">
              <priority value="debug"/>
              <appender-ref ref="notifications"/>
          </category>
          
          <root>
              <priority value="error"/>
              <appender-ref ref="servlet"/>
          </root>
      </log4j:configuration>
      

      In order to get

      Pushing message '{}' for tokens {}
      

      We got the notification token of some users using a script like this

      let population = "utilisateurs";
        const UserPreferencesHelper = Ametys.serviceManager.lookup("org.ametys.plugins.mobileapp.UserPreferencesHelper");
        
        printNotificationTokens("nico_veut_sa_notif");  
        
        function printNotificationTokens(login){
          let user = org.ametys.core.user.UserIdentity.stringToUserIdentity(`${login}#${population}`);
          Ametys.console.log(login+":"+UserPreferencesHelper.getNotificationTokens(user).toString());
        }
      

      I checked that the user is registered to the feed in his user pref

      select login,population,context,CONVERT(data USING utf8) from UserPreferences where login='nico_veut_sa_notif' and context like '%mobile%';
      

      I got the uid of the request stored in the request directory used by the mobileapp.

            cedric Cédric Damioli
            cedric Cédric Damioli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: