Message Boards
login.events.post not getting triggered in Liferay 7.1
login.events.post not getting triggered in Liferay 7.1
New Member Posts: 3 Join Date: 7/13/20 Recent PostsIn portal.properties
login.events.post = com.test.CustomLoginPostAction
Below is my CustomLoginPostAction, But its not getting triggered. any help is appreciated.
@Component(
immediate = true, property = {
"key=login.events.post",
},
service = LifecycleAction.class
)
public class
CustomLoginPostAction implements LifecycleAction {
private static final Log LOG =
LogFactory.getLog(CustomLoginPostAction.class);
private
boolean logUserLoginDate = true;
@Override
public void
processLifecycleEvent(LifecycleEvent lifecycleEvent) throws
ActionException {
// TODO Auto-generated method
stub
System.out.println("CustomLoginPostAction-------------------event
triggered");
if (logUserLoginDate) {
LOG.info("DEVELOPER says hello my login");
// Other functions called here
}
}
}
RE: login.events.post not getting triggered in Liferay 7.1
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsI've seen System.out.println() being swallowed often. Please use logging, or set a breakpoint in the debugger, i.e. make extra extra extra sure that your code is not called. Just observing that a System.out message doesn't appear is not enough. (use log.error, or make sure that info messages are indeed displayed)
You also don't need the portal-ext.properties entry. And note that your changes should go to portal-ext.properties (not portal.properties) anyway
RE: RE: login.events.post not getting triggered in Liferay 7.1
New Member Posts: 3 Join Date: 7/13/20 Recent PostsHi Olaf! Thanks for the reply... In my code i have some more functions other than System.out.println, which i did not add here. I have this CustomLoginPostAction in one of my portlet. As we upgraded from 6.1 to 7.1 this post.login.event stopped working. Whether this works in Portlets or should i create new Liferay Module Project. Should we add this post.login.events to the portal-ext.properties at root folder of Liferay? Thanks in advance!
RE: RE: login.events.post not getting triggered in Liferay 7.1
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsNo need for any portal-ext.properties any more - you'll just need to
deploy the declarative service (@Component).
Check if it's indeed
active: Go to Gogo Shell and enter "inspect cap service
bundleid" (of course with your bundle's own id (find out
which by typing "lb" in gogo shell). As your service here
might be simplified, there might be unmet dependencies, leading to
your portlet being available, but the post-login action unavailable.