掲示板

Adding loggers from custom portlets

6年前 に dj dj によって更新されました。

Adding loggers from custom portlets

New Member 投稿: 3 参加年月日: 16/07/26 最新の投稿
Since Liferay (in this case, Liferay 6.1) has an admin portlet for managing the Log levels and uses Log4JUtil for setting them, I would like to know if you understand why the rest of the custom portlets I am doing can't seem to add new loggers to its list. I have a portlet version in Liferay 6.2, but it uses this following code, which does not work on Liferay 6.1 because LogFactoryUtil doesn't have a getLogFactory() method:

LogFactoryUtil.getLogFactory().setLevel(loggerName, priority, true);



What I tried on Liferay 6.1:

Logger logger = Logger.getLogger(LogUtils.class);
logger.setLevel(Level.toLevel("DEBUG"));



OR

Log4JUtil.setLevel("com.liferay", "DEBUG", false);
LogManager.getLogger(LogUtils.class).setLevel(Level.DEBUG);



Previous code is not adding anything to the loggers.

PD: My custom portlet tries to show like a console the server logs, and I would like to add loggers too, since server administration can be hidden for certain roles and users.

Any indication would be appreciated.